@andrew_l/tl-pack 0.1.9 → 0.1.81

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.mts DELETED
@@ -1,28 +0,0 @@
1
- import { B as BinaryWriterOptions, a as BinaryReaderOptions } from './shared/tl-pack.CdcwN4dG.mjs';
2
- export { b as BinaryReader, c as BinaryWriter, C as CORE_TYPES, D as DecodeHandler, E as EncodeHandler, M as MAX_BUFFER_SIZE, T as TLExtension, d as createDictionary, e as createExtension } from './shared/tl-pack.CdcwN4dG.mjs';
3
-
4
- /**
5
- * Encode any value into `Uint8Array`
6
- *
7
- * @example
8
- * const buffer = tlEncode(new Date(0));
9
- *
10
- * console.log(buffer); // Uint8Array([5, 0, 0, 0, 0, 0, 0, 0, 0])
11
- *
12
- * @group Main
13
- */
14
- declare function tlEncode(value: unknown, opts?: BinaryWriterOptions): Uint8Array;
15
- /**
16
- * Decode value from `Uint8Array`
17
- *
18
- * @example
19
- * const buffer = new Uint8Array([5, 0, 0, 0, 0, 0, 0, 0, 0]);
20
- * const value = tlDecode(buffer);
21
- *
22
- * console.log(value); // Thu Jan 01 1970 01:00:00 GMT+0100 (Central European Standard Time)
23
- *
24
- * @group Main
25
- */
26
- declare function tlDecode<T = any>(buffer: Uint8Array, opts?: BinaryReaderOptions): T;
27
-
28
- export { BinaryReaderOptions, BinaryWriterOptions, tlDecode, tlEncode };
package/dist/index.mjs DELETED
@@ -1,28 +0,0 @@
1
- import { B as BinaryWriter, a as BinaryReader } from './shared/tl-pack.DnNse4P6.mjs';
2
- export { C as CORE_TYPES, M as MAX_BUFFER_SIZE, c as createDictionary } from './shared/tl-pack.DnNse4P6.mjs';
3
- import { assert } from '@andrew_l/toolkit';
4
- import 'pako';
5
-
6
- function createExtension(token, { encode, decode }) {
7
- assert.ok(Math.trunc(token) === token, " Token must be integer value.");
8
- assert.ok(
9
- token >= 0 && token <= 255,
10
- "Token must be a 8 bit number. (0 - 255)"
11
- );
12
- assert.ok(token >= 35, "Tokens from 0 to 34 reserved.");
13
- return {
14
- token,
15
- encode,
16
- decode
17
- };
18
- }
19
-
20
- function tlEncode(value, opts) {
21
- return new BinaryWriter(opts).writeObject(value).getBuffer();
22
- }
23
- function tlDecode(buffer, opts) {
24
- return new BinaryReader(buffer, opts).readObject();
25
- }
26
-
27
- export { BinaryReader, BinaryWriter, createExtension, tlDecode, tlEncode };
28
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/extension.ts","../src/index.ts"],"sourcesContent":["import { assert } from '@andrew_l/toolkit';\nimport type { BinaryReader } from './BinaryReader';\nimport type { BinaryWriter } from './BinaryWriter';\n\nexport type EncodeHandler = (this: BinaryWriter, value: any) => void;\n\nexport type DecodeHandler = (this: BinaryReader) => any;\n\nexport interface TLExtension {\n token: number;\n encode: EncodeHandler;\n decode: DecodeHandler;\n}\n\nexport function createExtension(\n token: number,\n { encode, decode }: { encode: EncodeHandler; decode: DecodeHandler },\n): TLExtension {\n assert.ok(Math.trunc(token) === token, ' Token must be integer value.');\n\n assert.ok(\n token >= 0 && token <= 255,\n 'Token must be a 8 bit number. (0 - 255)',\n );\n\n assert.ok(token >= 35, 'Tokens from 0 to 34 reserved.');\n\n return {\n token,\n encode,\n decode,\n };\n}\n","import { BinaryReader, type BinaryReaderOptions } from './BinaryReader';\nimport { BinaryWriter, type BinaryWriterOptions } from './BinaryWriter';\n\nexport { BinaryReader, type BinaryReaderOptions } from './BinaryReader';\nexport { BinaryWriter, type BinaryWriterOptions } from './BinaryWriter';\nexport * from './constants';\nexport { createDictionary } from './dictionary';\nexport {\n createExtension,\n type DecodeHandler,\n type EncodeHandler,\n type TLExtension,\n} from './extension';\n\n/**\n * Encode any value into `Uint8Array`\n *\n * @example\n * const buffer = tlEncode(new Date(0));\n *\n * console.log(buffer); // Uint8Array([5, 0, 0, 0, 0, 0, 0, 0, 0])\n *\n * @group Main\n */\nexport function tlEncode(\n value: unknown,\n opts?: BinaryWriterOptions,\n): Uint8Array {\n return new BinaryWriter(opts).writeObject(value).getBuffer();\n}\n\n/**\n * Decode value from `Uint8Array`\n *\n * @example\n * const buffer = new Uint8Array([5, 0, 0, 0, 0, 0, 0, 0, 0]);\n * const value = tlDecode(buffer);\n *\n * console.log(value); // Thu Jan 01 1970 01:00:00 GMT+0100 (Central European Standard Time)\n *\n * @group Main\n */\nexport function tlDecode<T = any>(\n buffer: Uint8Array,\n opts?: BinaryReaderOptions,\n): T {\n return new BinaryReader(buffer, opts).readObject();\n}\n"],"names":[],"mappings":";;;;;AAcO,SAAS,eACd,CAAA,KAAA,EACA,EAAE,MAAA,EAAQ,QACG,EAAA;AACb,EAAA,MAAA,CAAO,GAAG,IAAK,CAAA,KAAA,CAAM,KAAK,CAAA,KAAM,OAAO,+BAA+B,CAAA,CAAA;AAEtE,EAAO,MAAA,CAAA,EAAA;AAAA,IACL,KAAA,IAAS,KAAK,KAAS,IAAA,GAAA;AAAA,IACvB,yCAAA;AAAA,GACF,CAAA;AAEA,EAAO,MAAA,CAAA,EAAA,CAAG,KAAS,IAAA,EAAA,EAAI,+BAA+B,CAAA,CAAA;AAEtD,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,GACF,CAAA;AACF;;ACRgB,SAAA,QAAA,CACd,OACA,IACY,EAAA;AACZ,EAAA,OAAO,IAAI,YAAa,CAAA,IAAI,EAAE,WAAY,CAAA,KAAK,EAAE,SAAU,EAAA,CAAA;AAC7D,CAAA;AAagB,SAAA,QAAA,CACd,QACA,IACG,EAAA;AACH,EAAA,OAAO,IAAI,YAAA,CAAa,MAAQ,EAAA,IAAI,EAAE,UAAW,EAAA,CAAA;AACnD;;;;"}
@@ -1,195 +0,0 @@
1
- declare enum CORE_TYPES {
2
- None = 0,
3
- Binary = 1,
4
- BoolFalse = 2,
5
- BoolTrue = 3,
6
- Null = 4,
7
- Date = 5,
8
- Vector = 6,
9
- VectorDynamic = 7,
10
- Int32 = 8,
11
- Int16 = 9,
12
- Int8 = 10,
13
- UInt32 = 11,
14
- UInt16 = 12,
15
- UInt8 = 13,
16
- Float = 14,
17
- Double = 15,
18
- Map = 16,
19
- DictValue = 17,
20
- DictIndex = 18,
21
- String = 19,
22
- Repeat = 20,
23
- GZIP = 25
24
- }
25
- declare const MAX_BUFFER_SIZE = 2144337920;
26
-
27
- declare function createDictionary(values?: string[]): Dictionary;
28
- declare class Dictionary {
29
- private _count;
30
- private _wordToIndex;
31
- private _words;
32
- private _offset;
33
- constructor(values?: string[], offset?: number);
34
- get size(): number;
35
- /**
36
- * Returns inserted index or nothing
37
- */
38
- maybeInsert(word: string): number | null;
39
- getValue(index: number): string | null;
40
- getIndex(value: string): number | null;
41
- hasValue(value: string): boolean;
42
- hasIndex(index: number): boolean;
43
- }
44
-
45
- interface BinaryWriterOptions {
46
- gzip?: boolean;
47
- dictionary?: string[] | Dictionary;
48
- extensions?: TLExtension[];
49
- }
50
- declare class BinaryWriter {
51
- private withGzip;
52
- private target;
53
- private dictionary?;
54
- private dictionaryExtended;
55
- private extensions;
56
- private _last;
57
- private _repeat?;
58
- offset: number;
59
- constructor(options?: BinaryWriterOptions);
60
- allocate(size: number): this;
61
- private makeRoom;
62
- get safeEnd(): number;
63
- getBuffer(): Uint8Array;
64
- writeByte(value: number): this;
65
- writeBool(value: boolean): this;
66
- writeNull(): this;
67
- writeInt32(value: number, signed?: boolean): this;
68
- writeInt16(value: number, signed?: boolean): this;
69
- writeInt8(value: number, signed?: boolean): this;
70
- writeFloat(value: number): this;
71
- writeDouble(value: number): this;
72
- writeDate(value: number | Date): this;
73
- writeString(value: string): this;
74
- writeBytes(value: Uint8Array): this;
75
- writeLength(value: number): this;
76
- writeVector(value: Array<any>): this;
77
- writeMap(object: Record<string, any>): this;
78
- wireDictionary(value: string): this;
79
- writeGzip(value: Uint8Array | ArrayBuffer): this;
80
- encode(value: any): Uint8Array;
81
- startDynamicVector(): this;
82
- endDynamicVector(): this;
83
- private _writeCustom;
84
- writeObject(value: any): this;
85
- writeObjectGzip(value: any): this;
86
- private writeCore;
87
- private writeRepeat;
88
- }
89
-
90
- type EncodeHandler = (this: BinaryWriter, value: any) => void;
91
- type DecodeHandler = (this: BinaryReader) => any;
92
- interface TLExtension {
93
- token: number;
94
- encode: EncodeHandler;
95
- decode: DecodeHandler;
96
- }
97
- declare function createExtension(token: number, { encode, decode }: {
98
- encode: EncodeHandler;
99
- decode: DecodeHandler;
100
- }): TLExtension;
101
-
102
- interface BinaryReaderOptions {
103
- dictionary?: string[] | Dictionary;
104
- extensions?: TLExtension[];
105
- }
106
- declare class BinaryReader {
107
- private target;
108
- private _last?;
109
- private _lastObject?;
110
- private dictionary?;
111
- private dictionaryExtended;
112
- private extensions;
113
- private _repeat?;
114
- offset: number;
115
- length: number;
116
- /**
117
- * Small utility class to read binary data.
118
- */
119
- constructor(data: Uint8Array, options?: BinaryReaderOptions);
120
- readByte(): number;
121
- readInt32(signed?: boolean): number;
122
- readInt16(signed?: boolean): number;
123
- readInt8(signed?: boolean): number;
124
- /**
125
- * Reads a real floating point (4 bytes) value.
126
- * @returns {number}
127
- */
128
- readFloat(): number;
129
- /**
130
- * Reads a real floating point (8 bytes) value.
131
- * @returns {BigInteger}
132
- */
133
- readDouble(): number;
134
- /**
135
- * Read the given amount of bytes, or -1 to read all remaining.
136
- * @param length {number}
137
- */
138
- assertRead(length: number): void;
139
- assertConstructor(constructorId: CORE_TYPES): void;
140
- /**
141
- * Gets the byte array representing the current buffer as a whole.
142
- */
143
- getBuffer(): Uint8Array;
144
- readNull(): null;
145
- readLength(): number;
146
- readAll(): any[];
147
- readBytes(): Uint8Array;
148
- /**
149
- * Reads encoded string.
150
- */
151
- readString(): string;
152
- /**
153
- * Reads a boolean value.
154
- */
155
- readBool(): boolean;
156
- /**
157
- * Reads and converts Unix time
158
- * into a Javascript {Date} object.
159
- */
160
- readDate(): Date;
161
- /**
162
- * Reads a object.
163
- */
164
- readObject(): any;
165
- readObjectGzip(): any;
166
- readGzip(): any;
167
- private readCore;
168
- getDictionaryValue(index: number): string | null;
169
- readDictionary(): null | string;
170
- readMap(checkConstructor?: boolean): Record<string, any>;
171
- decode<T = any>(value: Uint8Array): T;
172
- /**
173
- * Reads a vector (a list) of objects.
174
- */
175
- readVector<T = any>(checkConstructor?: boolean): T[];
176
- /**
177
- * Reads a vector (a list) of objects.
178
- */
179
- readVectorDynamic<T>(checkConstructor?: boolean): T[];
180
- /**
181
- * Tells the current position on the stream.
182
- */
183
- tellPosition(): number;
184
- /**
185
- * Sets the current position on the stream.
186
- */
187
- setPosition(position: number): void;
188
- /**
189
- * Seeks the stream position given an offset from the current position.
190
- * The offset may be negative.
191
- */
192
- seek(offset: number): void;
193
- }
194
-
195
- export { type BinaryWriterOptions as B, CORE_TYPES as C, type DecodeHandler as D, type EncodeHandler as E, MAX_BUFFER_SIZE as M, type TLExtension as T, type BinaryReaderOptions as a, BinaryReader as b, BinaryWriter as c, createDictionary as d, createExtension as e };
@@ -1,195 +0,0 @@
1
- declare enum CORE_TYPES {
2
- None = 0,
3
- Binary = 1,
4
- BoolFalse = 2,
5
- BoolTrue = 3,
6
- Null = 4,
7
- Date = 5,
8
- Vector = 6,
9
- VectorDynamic = 7,
10
- Int32 = 8,
11
- Int16 = 9,
12
- Int8 = 10,
13
- UInt32 = 11,
14
- UInt16 = 12,
15
- UInt8 = 13,
16
- Float = 14,
17
- Double = 15,
18
- Map = 16,
19
- DictValue = 17,
20
- DictIndex = 18,
21
- String = 19,
22
- Repeat = 20,
23
- GZIP = 25
24
- }
25
- declare const MAX_BUFFER_SIZE = 2144337920;
26
-
27
- declare function createDictionary(values?: string[]): Dictionary;
28
- declare class Dictionary {
29
- private _count;
30
- private _wordToIndex;
31
- private _words;
32
- private _offset;
33
- constructor(values?: string[], offset?: number);
34
- get size(): number;
35
- /**
36
- * Returns inserted index or nothing
37
- */
38
- maybeInsert(word: string): number | null;
39
- getValue(index: number): string | null;
40
- getIndex(value: string): number | null;
41
- hasValue(value: string): boolean;
42
- hasIndex(index: number): boolean;
43
- }
44
-
45
- interface BinaryWriterOptions {
46
- gzip?: boolean;
47
- dictionary?: string[] | Dictionary;
48
- extensions?: TLExtension[];
49
- }
50
- declare class BinaryWriter {
51
- private withGzip;
52
- private target;
53
- private dictionary?;
54
- private dictionaryExtended;
55
- private extensions;
56
- private _last;
57
- private _repeat?;
58
- offset: number;
59
- constructor(options?: BinaryWriterOptions);
60
- allocate(size: number): this;
61
- private makeRoom;
62
- get safeEnd(): number;
63
- getBuffer(): Uint8Array;
64
- writeByte(value: number): this;
65
- writeBool(value: boolean): this;
66
- writeNull(): this;
67
- writeInt32(value: number, signed?: boolean): this;
68
- writeInt16(value: number, signed?: boolean): this;
69
- writeInt8(value: number, signed?: boolean): this;
70
- writeFloat(value: number): this;
71
- writeDouble(value: number): this;
72
- writeDate(value: number | Date): this;
73
- writeString(value: string): this;
74
- writeBytes(value: Uint8Array): this;
75
- writeLength(value: number): this;
76
- writeVector(value: Array<any>): this;
77
- writeMap(object: Record<string, any>): this;
78
- wireDictionary(value: string): this;
79
- writeGzip(value: Uint8Array | ArrayBuffer): this;
80
- encode(value: any): Uint8Array;
81
- startDynamicVector(): this;
82
- endDynamicVector(): this;
83
- private _writeCustom;
84
- writeObject(value: any): this;
85
- writeObjectGzip(value: any): this;
86
- private writeCore;
87
- private writeRepeat;
88
- }
89
-
90
- type EncodeHandler = (this: BinaryWriter, value: any) => void;
91
- type DecodeHandler = (this: BinaryReader) => any;
92
- interface TLExtension {
93
- token: number;
94
- encode: EncodeHandler;
95
- decode: DecodeHandler;
96
- }
97
- declare function createExtension(token: number, { encode, decode }: {
98
- encode: EncodeHandler;
99
- decode: DecodeHandler;
100
- }): TLExtension;
101
-
102
- interface BinaryReaderOptions {
103
- dictionary?: string[] | Dictionary;
104
- extensions?: TLExtension[];
105
- }
106
- declare class BinaryReader {
107
- private target;
108
- private _last?;
109
- private _lastObject?;
110
- private dictionary?;
111
- private dictionaryExtended;
112
- private extensions;
113
- private _repeat?;
114
- offset: number;
115
- length: number;
116
- /**
117
- * Small utility class to read binary data.
118
- */
119
- constructor(data: Uint8Array, options?: BinaryReaderOptions);
120
- readByte(): number;
121
- readInt32(signed?: boolean): number;
122
- readInt16(signed?: boolean): number;
123
- readInt8(signed?: boolean): number;
124
- /**
125
- * Reads a real floating point (4 bytes) value.
126
- * @returns {number}
127
- */
128
- readFloat(): number;
129
- /**
130
- * Reads a real floating point (8 bytes) value.
131
- * @returns {BigInteger}
132
- */
133
- readDouble(): number;
134
- /**
135
- * Read the given amount of bytes, or -1 to read all remaining.
136
- * @param length {number}
137
- */
138
- assertRead(length: number): void;
139
- assertConstructor(constructorId: CORE_TYPES): void;
140
- /**
141
- * Gets the byte array representing the current buffer as a whole.
142
- */
143
- getBuffer(): Uint8Array;
144
- readNull(): null;
145
- readLength(): number;
146
- readAll(): any[];
147
- readBytes(): Uint8Array;
148
- /**
149
- * Reads encoded string.
150
- */
151
- readString(): string;
152
- /**
153
- * Reads a boolean value.
154
- */
155
- readBool(): boolean;
156
- /**
157
- * Reads and converts Unix time
158
- * into a Javascript {Date} object.
159
- */
160
- readDate(): Date;
161
- /**
162
- * Reads a object.
163
- */
164
- readObject(): any;
165
- readObjectGzip(): any;
166
- readGzip(): any;
167
- private readCore;
168
- getDictionaryValue(index: number): string | null;
169
- readDictionary(): null | string;
170
- readMap(checkConstructor?: boolean): Record<string, any>;
171
- decode<T = any>(value: Uint8Array): T;
172
- /**
173
- * Reads a vector (a list) of objects.
174
- */
175
- readVector<T = any>(checkConstructor?: boolean): T[];
176
- /**
177
- * Reads a vector (a list) of objects.
178
- */
179
- readVectorDynamic<T>(checkConstructor?: boolean): T[];
180
- /**
181
- * Tells the current position on the stream.
182
- */
183
- tellPosition(): number;
184
- /**
185
- * Sets the current position on the stream.
186
- */
187
- setPosition(position: number): void;
188
- /**
189
- * Seeks the stream position given an offset from the current position.
190
- * The offset may be negative.
191
- */
192
- seek(offset: number): void;
193
- }
194
-
195
- export { type BinaryWriterOptions as B, CORE_TYPES as C, type DecodeHandler as D, type EncodeHandler as E, MAX_BUFFER_SIZE as M, type TLExtension as T, type BinaryReaderOptions as a, BinaryReader as b, BinaryWriter as c, createDictionary as d, createExtension as e };
@@ -1,195 +0,0 @@
1
- declare enum CORE_TYPES {
2
- None = 0,
3
- Binary = 1,
4
- BoolFalse = 2,
5
- BoolTrue = 3,
6
- Null = 4,
7
- Date = 5,
8
- Vector = 6,
9
- VectorDynamic = 7,
10
- Int32 = 8,
11
- Int16 = 9,
12
- Int8 = 10,
13
- UInt32 = 11,
14
- UInt16 = 12,
15
- UInt8 = 13,
16
- Float = 14,
17
- Double = 15,
18
- Map = 16,
19
- DictValue = 17,
20
- DictIndex = 18,
21
- String = 19,
22
- Repeat = 20,
23
- GZIP = 25
24
- }
25
- declare const MAX_BUFFER_SIZE = 2144337920;
26
-
27
- declare function createDictionary(values?: string[]): Dictionary;
28
- declare class Dictionary {
29
- private _count;
30
- private _wordToIndex;
31
- private _words;
32
- private _offset;
33
- constructor(values?: string[], offset?: number);
34
- get size(): number;
35
- /**
36
- * Returns inserted index or nothing
37
- */
38
- maybeInsert(word: string): number | null;
39
- getValue(index: number): string | null;
40
- getIndex(value: string): number | null;
41
- hasValue(value: string): boolean;
42
- hasIndex(index: number): boolean;
43
- }
44
-
45
- interface BinaryWriterOptions {
46
- gzip?: boolean;
47
- dictionary?: string[] | Dictionary;
48
- extensions?: TLExtension[];
49
- }
50
- declare class BinaryWriter {
51
- private withGzip;
52
- private target;
53
- private dictionary?;
54
- private dictionaryExtended;
55
- private extensions;
56
- private _last;
57
- private _repeat?;
58
- offset: number;
59
- constructor(options?: BinaryWriterOptions);
60
- allocate(size: number): this;
61
- private makeRoom;
62
- get safeEnd(): number;
63
- getBuffer(): Uint8Array;
64
- writeByte(value: number): this;
65
- writeBool(value: boolean): this;
66
- writeNull(): this;
67
- writeInt32(value: number, signed?: boolean): this;
68
- writeInt16(value: number, signed?: boolean): this;
69
- writeInt8(value: number, signed?: boolean): this;
70
- writeFloat(value: number): this;
71
- writeDouble(value: number): this;
72
- writeDate(value: number | Date): this;
73
- writeString(value: string): this;
74
- writeBytes(value: Uint8Array): this;
75
- writeLength(value: number): this;
76
- writeVector(value: Array<any>): this;
77
- writeMap(object: Record<string, any>): this;
78
- wireDictionary(value: string): this;
79
- writeGzip(value: Uint8Array | ArrayBuffer): this;
80
- encode(value: any): Uint8Array;
81
- startDynamicVector(): this;
82
- endDynamicVector(): this;
83
- private _writeCustom;
84
- writeObject(value: any): this;
85
- writeObjectGzip(value: any): this;
86
- private writeCore;
87
- private writeRepeat;
88
- }
89
-
90
- type EncodeHandler = (this: BinaryWriter, value: any) => void;
91
- type DecodeHandler = (this: BinaryReader) => any;
92
- interface TLExtension {
93
- token: number;
94
- encode: EncodeHandler;
95
- decode: DecodeHandler;
96
- }
97
- declare function createExtension(token: number, { encode, decode }: {
98
- encode: EncodeHandler;
99
- decode: DecodeHandler;
100
- }): TLExtension;
101
-
102
- interface BinaryReaderOptions {
103
- dictionary?: string[] | Dictionary;
104
- extensions?: TLExtension[];
105
- }
106
- declare class BinaryReader {
107
- private target;
108
- private _last?;
109
- private _lastObject?;
110
- private dictionary?;
111
- private dictionaryExtended;
112
- private extensions;
113
- private _repeat?;
114
- offset: number;
115
- length: number;
116
- /**
117
- * Small utility class to read binary data.
118
- */
119
- constructor(data: Uint8Array, options?: BinaryReaderOptions);
120
- readByte(): number;
121
- readInt32(signed?: boolean): number;
122
- readInt16(signed?: boolean): number;
123
- readInt8(signed?: boolean): number;
124
- /**
125
- * Reads a real floating point (4 bytes) value.
126
- * @returns {number}
127
- */
128
- readFloat(): number;
129
- /**
130
- * Reads a real floating point (8 bytes) value.
131
- * @returns {BigInteger}
132
- */
133
- readDouble(): number;
134
- /**
135
- * Read the given amount of bytes, or -1 to read all remaining.
136
- * @param length {number}
137
- */
138
- assertRead(length: number): void;
139
- assertConstructor(constructorId: CORE_TYPES): void;
140
- /**
141
- * Gets the byte array representing the current buffer as a whole.
142
- */
143
- getBuffer(): Uint8Array;
144
- readNull(): null;
145
- readLength(): number;
146
- readAll(): any[];
147
- readBytes(): Uint8Array;
148
- /**
149
- * Reads encoded string.
150
- */
151
- readString(): string;
152
- /**
153
- * Reads a boolean value.
154
- */
155
- readBool(): boolean;
156
- /**
157
- * Reads and converts Unix time
158
- * into a Javascript {Date} object.
159
- */
160
- readDate(): Date;
161
- /**
162
- * Reads a object.
163
- */
164
- readObject(): any;
165
- readObjectGzip(): any;
166
- readGzip(): any;
167
- private readCore;
168
- getDictionaryValue(index: number): string | null;
169
- readDictionary(): null | string;
170
- readMap(checkConstructor?: boolean): Record<string, any>;
171
- decode<T = any>(value: Uint8Array): T;
172
- /**
173
- * Reads a vector (a list) of objects.
174
- */
175
- readVector<T = any>(checkConstructor?: boolean): T[];
176
- /**
177
- * Reads a vector (a list) of objects.
178
- */
179
- readVectorDynamic<T>(checkConstructor?: boolean): T[];
180
- /**
181
- * Tells the current position on the stream.
182
- */
183
- tellPosition(): number;
184
- /**
185
- * Sets the current position on the stream.
186
- */
187
- setPosition(position: number): void;
188
- /**
189
- * Seeks the stream position given an offset from the current position.
190
- * The offset may be negative.
191
- */
192
- seek(offset: number): void;
193
- }
194
-
195
- export { type BinaryWriterOptions as B, CORE_TYPES as C, type DecodeHandler as D, type EncodeHandler as E, MAX_BUFFER_SIZE as M, type TLExtension as T, type BinaryReaderOptions as a, BinaryReader as b, BinaryWriter as c, createDictionary as d, createExtension as e };