steamutils 1.4.41 → 1.4.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_steamproto.js +29 -29
- package/full_steamproto.js +3 -16100
- package/package.json +2 -1
- package/steamproto.js +3 -298
package/_steamproto.js
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
import path from "path";
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const root =
|
15
|
-
keepCase: true,
|
16
|
-
});
|
17
|
-
return root[this._proto.name];
|
18
|
-
}
|
19
|
-
|
20
|
-
protoEncode(obj) {
|
21
|
-
const protobuf = this.toProto();
|
22
|
-
return protobuf.encode(protobuf.create(obj)).finish();
|
23
|
-
}
|
24
|
-
|
25
|
-
protoDecode(obj) {
|
26
|
-
const protobuf = this.toProto();
|
27
|
-
return protobuf.toObject(protobuf.decode(obj), { defaults: true });
|
28
|
-
}
|
29
|
-
}
|
1
|
+
import path from "path";
|
2
|
+
import { fileURLToPath } from "url";
|
3
|
+
import Protobuf from "protobufjs";
|
4
|
+
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
6
|
+
const __dirname = path.dirname(__filename);
|
7
|
+
|
8
|
+
export class SteamProto {
|
9
|
+
constructor(proto) {
|
10
|
+
this._proto = proto;
|
11
|
+
}
|
12
|
+
|
13
|
+
toProto() {
|
14
|
+
const root = new Protobuf.Root().loadSync(path.join(`${__dirname}/protos/`, this._proto.filename), {
|
15
|
+
keepCase: true,
|
16
|
+
});
|
17
|
+
return root[this._proto.name];
|
18
|
+
}
|
19
|
+
|
20
|
+
protoEncode(obj) {
|
21
|
+
const protobuf = this.toProto();
|
22
|
+
return protobuf.encode(protobuf.create(obj)).finish();
|
23
|
+
}
|
24
|
+
|
25
|
+
protoDecode(obj) {
|
26
|
+
const protobuf = this.toProto();
|
27
|
+
return protobuf.toObject(protobuf.decode(obj), { defaults: true });
|
28
|
+
}
|
29
|
+
}
|