@dataclash/serializer 0.0.0-stage → 1.0.0
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/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +164 -0
- package/dist/index.js.map +1 -0
- package/package.json +23 -4
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare class Serializer {
|
|
2
|
+
static from(bytes: Uint8Array): Serializer;
|
|
3
|
+
private static encoder;
|
|
4
|
+
private static decoder;
|
|
5
|
+
cursor: number;
|
|
6
|
+
private buffer;
|
|
7
|
+
private array;
|
|
8
|
+
private view;
|
|
9
|
+
private littleEndian;
|
|
10
|
+
constructor(defaultSize: number, options?: {
|
|
11
|
+
endianness: "little" | "big";
|
|
12
|
+
});
|
|
13
|
+
constructor(buffer: ArrayBuffer, options?: {
|
|
14
|
+
endianness: "little" | "big";
|
|
15
|
+
});
|
|
16
|
+
toBuffer(): ArrayBuffer;
|
|
17
|
+
toUint8Array(): Uint8Array<ArrayBuffer>;
|
|
18
|
+
writeUint8(value: number): this;
|
|
19
|
+
writeInt8(value: number): this;
|
|
20
|
+
writeUint16(value: number): this;
|
|
21
|
+
writeInt16(value: number): this;
|
|
22
|
+
writeUint32(value: number): this;
|
|
23
|
+
writeInt32(value: number): this;
|
|
24
|
+
writeFloat32(value: number): this;
|
|
25
|
+
writeUint64(value: bigint): this;
|
|
26
|
+
writeInt64(value: bigint): this;
|
|
27
|
+
readUint8(): number;
|
|
28
|
+
readInt8(): number;
|
|
29
|
+
readUint16(): number;
|
|
30
|
+
readInt16(): number;
|
|
31
|
+
readUint32(): number;
|
|
32
|
+
readInt32(): number;
|
|
33
|
+
readFloat32(): number;
|
|
34
|
+
readUint64(): bigint;
|
|
35
|
+
readInt64(): bigint;
|
|
36
|
+
writeBytes(bytes: Uint8Array, manual?: boolean): this;
|
|
37
|
+
readBytes(length?: number): Uint8Array<ArrayBuffer>;
|
|
38
|
+
writeString(text: string): this;
|
|
39
|
+
readString(): string;
|
|
40
|
+
private ensureSize;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACnB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,cAI5B;IAED,OAAO,CAAC,MAAM,CAAC,OAAO,CAAqB;IAC3C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAqB;IAE3C,MAAM,SAAK;IAEX,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,YAAY,CAAU;IAE9B,YAAY,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QACvC,UAAU,EAAE,QAAQ,GAAC,KAAK,CAAC;KAC9B,EAAE;IACH,YAAY,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QACvC,UAAU,EAAE,QAAQ,GAAC,KAAK,CAAC;KAC9B,EAAE;IAWH,QAAQ,gBAEP;IAED,YAAY,4BAEX;IAED,UAAU,CAAC,KAAK,EAAE,MAAM,QAKvB;IACD,SAAS,CAAC,KAAK,EAAE,MAAM,QAKtB;IACD,WAAW,CAAC,KAAK,EAAE,MAAM,QAKxB;IACD,UAAU,CAAC,KAAK,EAAE,MAAM,QAKvB;IACD,WAAW,CAAC,KAAK,EAAE,MAAM,QAKxB;IACD,UAAU,CAAC,KAAK,EAAE,MAAM,QAKvB;IACD,YAAY,CAAC,KAAK,EAAE,MAAM,QAKzB;IACD,WAAW,CAAC,KAAK,EAAE,MAAM,QAKxB;IACD,UAAU,CAAC,KAAK,EAAE,MAAM,QAKvB;IAED,SAAS,WAIR;IACD,QAAQ,WAIP;IACD,UAAU,WAIT;IACD,SAAS,WAIR;IACD,UAAU,WAIT;IACD,SAAS,WAIR;IACD,WAAW,WAIV;IACD,UAAU,WAIT;IACD,SAAS,WAIR;IAED,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,UAAQ,QAO3C;IAED,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,2BAQxB;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,QAGvB;IAED,UAAU,WAET;IAED,OAAO,CAAC,UAAU;CAWrB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export class Serializer {
|
|
2
|
+
static from(bytes) {
|
|
3
|
+
const packet = new Serializer(bytes.length);
|
|
4
|
+
packet.array.set(bytes);
|
|
5
|
+
return packet;
|
|
6
|
+
}
|
|
7
|
+
static encoder = new TextEncoder();
|
|
8
|
+
static decoder = new TextDecoder();
|
|
9
|
+
cursor = 0;
|
|
10
|
+
buffer;
|
|
11
|
+
array;
|
|
12
|
+
view;
|
|
13
|
+
littleEndian;
|
|
14
|
+
constructor(sizeOrBuffer, options) {
|
|
15
|
+
this.buffer = typeof sizeOrBuffer === "number" ? new ArrayBuffer(sizeOrBuffer) : sizeOrBuffer.slice(0, sizeOrBuffer.byteLength);
|
|
16
|
+
this.array = new Uint8Array(this.buffer);
|
|
17
|
+
this.view = new DataView(this.buffer);
|
|
18
|
+
if (!options)
|
|
19
|
+
this.littleEndian = true;
|
|
20
|
+
else
|
|
21
|
+
this.littleEndian = options.endianness === "big" ? false : true;
|
|
22
|
+
}
|
|
23
|
+
toBuffer() {
|
|
24
|
+
return this.buffer.slice(0, this.cursor);
|
|
25
|
+
}
|
|
26
|
+
toUint8Array() {
|
|
27
|
+
return this.array.slice(0, this.cursor);
|
|
28
|
+
}
|
|
29
|
+
writeUint8(value) {
|
|
30
|
+
this.ensureSize(1);
|
|
31
|
+
this.view.setUint8(this.cursor, value);
|
|
32
|
+
this.cursor += 1;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
writeInt8(value) {
|
|
36
|
+
this.ensureSize(1);
|
|
37
|
+
this.view.setInt8(this.cursor, value);
|
|
38
|
+
this.cursor += 1;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
writeUint16(value) {
|
|
42
|
+
this.ensureSize(2);
|
|
43
|
+
this.view.setUint16(this.cursor, value, this.littleEndian);
|
|
44
|
+
this.cursor += 2;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
writeInt16(value) {
|
|
48
|
+
this.ensureSize(2);
|
|
49
|
+
this.view.setInt16(this.cursor, value, this.littleEndian);
|
|
50
|
+
this.cursor += 2;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
writeUint32(value) {
|
|
54
|
+
this.ensureSize(4);
|
|
55
|
+
this.view.setUint32(this.cursor, value, this.littleEndian);
|
|
56
|
+
this.cursor += 4;
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
writeInt32(value) {
|
|
60
|
+
this.ensureSize(4);
|
|
61
|
+
this.view.setInt32(this.cursor, value, this.littleEndian);
|
|
62
|
+
this.cursor += 4;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
writeFloat32(value) {
|
|
66
|
+
this.ensureSize(4);
|
|
67
|
+
this.view.setFloat32(this.cursor, value, this.littleEndian);
|
|
68
|
+
this.cursor += 4;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
writeUint64(value) {
|
|
72
|
+
this.ensureSize(8);
|
|
73
|
+
this.view.setBigUint64(this.cursor, value, this.littleEndian);
|
|
74
|
+
this.cursor += 8;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
writeInt64(value) {
|
|
78
|
+
this.ensureSize(8);
|
|
79
|
+
this.view.setBigInt64(this.cursor, value, this.littleEndian);
|
|
80
|
+
this.cursor += 8;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
readUint8() {
|
|
84
|
+
const value = this.view.getUint8(this.cursor);
|
|
85
|
+
this.cursor += 1;
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
readInt8() {
|
|
89
|
+
const value = this.view.getInt8(this.cursor);
|
|
90
|
+
this.cursor += 1;
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
readUint16() {
|
|
94
|
+
const value = this.view.getUint16(this.cursor, this.littleEndian);
|
|
95
|
+
this.cursor += 2;
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
readInt16() {
|
|
99
|
+
const value = this.view.getInt16(this.cursor, this.littleEndian);
|
|
100
|
+
this.cursor += 2;
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
readUint32() {
|
|
104
|
+
const value = this.view.getUint32(this.cursor, this.littleEndian);
|
|
105
|
+
this.cursor += 4;
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
readInt32() {
|
|
109
|
+
const value = this.view.getInt32(this.cursor, this.littleEndian);
|
|
110
|
+
this.cursor += 4;
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
readFloat32() {
|
|
114
|
+
const value = this.view.getFloat32(this.cursor, this.littleEndian);
|
|
115
|
+
this.cursor += 4;
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
readUint64() {
|
|
119
|
+
const value = this.view.getBigUint64(this.cursor, this.littleEndian);
|
|
120
|
+
this.cursor += 8;
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
readInt64() {
|
|
124
|
+
const value = this.view.getBigInt64(this.cursor, this.littleEndian);
|
|
125
|
+
this.cursor += 8;
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
writeBytes(bytes, manual = false) {
|
|
129
|
+
if (!manual)
|
|
130
|
+
this.writeUint32(bytes.length);
|
|
131
|
+
this.ensureSize(bytes.length);
|
|
132
|
+
this.array.set(bytes, this.cursor);
|
|
133
|
+
this.cursor += bytes.length;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
readBytes(length) {
|
|
137
|
+
if (length === undefined) {
|
|
138
|
+
length = this.readUint32();
|
|
139
|
+
}
|
|
140
|
+
const value = this.array.slice(this.cursor, this.cursor + length);
|
|
141
|
+
this.cursor += length;
|
|
142
|
+
return value;
|
|
143
|
+
}
|
|
144
|
+
writeString(text) {
|
|
145
|
+
this.writeBytes(Serializer.encoder.encode(text));
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
readString() {
|
|
149
|
+
return Serializer.decoder.decode(this.readBytes());
|
|
150
|
+
}
|
|
151
|
+
ensureSize(desiredBytes) {
|
|
152
|
+
const remainingBytes = this.buffer.byteLength - this.cursor;
|
|
153
|
+
if (remainingBytes > desiredBytes)
|
|
154
|
+
return;
|
|
155
|
+
const bytesToAdd = desiredBytes - remainingBytes;
|
|
156
|
+
const buffer = new ArrayBuffer(this.buffer.byteLength * 2 + bytesToAdd);
|
|
157
|
+
const arr = new Uint8Array(buffer.byteLength);
|
|
158
|
+
arr.set(this.array);
|
|
159
|
+
this.buffer = buffer;
|
|
160
|
+
this.array = arr;
|
|
161
|
+
this.view = new DataView(this.buffer);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAU;IACnB,MAAM,CAAC,IAAI,CAAC,KAAiB;QACzB,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,MAAM,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IACnC,MAAM,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAE3C,MAAM,GAAG,CAAC,CAAC;IAEH,MAAM,CA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GAAG,UAAU,CAAC,CAAC;QACtE,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataclash/serializer",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Serializer class for constructing buffers piece by piece",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": ["dist"],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
16
|
+
},
|
|
17
|
+
"keywords": ["typescript"],
|
|
18
|
+
"author": "dataclash",
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"ts-node": "^10.9.2",
|
|
23
|
+
"typescript": "^7.0.2"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/README.md
DELETED