1 | declare module "safe-buffer" {
|
2 | export class Buffer {
|
3 | length: number
|
4 | write(string: string, offset?: number, length?: number, encoding?: string): number;
|
5 | toString(encoding?: string, start?: number, end?: number): string;
|
6 | toJSON(): { type: 'Buffer', data: any[] };
|
7 | equals(otherBuffer: Buffer): boolean;
|
8 | compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
9 | copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
10 | slice(start?: number, end?: number): Buffer;
|
11 | writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
12 | writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
13 | writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
14 | writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
15 | readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
16 | readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
17 | readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
18 | readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
19 | readUInt8(offset: number, noAssert?: boolean): number;
|
20 | readUInt16LE(offset: number, noAssert?: boolean): number;
|
21 | readUInt16BE(offset: number, noAssert?: boolean): number;
|
22 | readUInt32LE(offset: number, noAssert?: boolean): number;
|
23 | readUInt32BE(offset: number, noAssert?: boolean): number;
|
24 | readInt8(offset: number, noAssert?: boolean): number;
|
25 | readInt16LE(offset: number, noAssert?: boolean): number;
|
26 | readInt16BE(offset: number, noAssert?: boolean): number;
|
27 | readInt32LE(offset: number, noAssert?: boolean): number;
|
28 | readInt32BE(offset: number, noAssert?: boolean): number;
|
29 | readFloatLE(offset: number, noAssert?: boolean): number;
|
30 | readFloatBE(offset: number, noAssert?: boolean): number;
|
31 | readDoubleLE(offset: number, noAssert?: boolean): number;
|
32 | readDoubleBE(offset: number, noAssert?: boolean): number;
|
33 | swap16(): Buffer;
|
34 | swap32(): Buffer;
|
35 | swap64(): Buffer;
|
36 | writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
37 | writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
38 | writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
39 | writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
40 | writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
41 | writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
42 | writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
43 | writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
44 | writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
45 | writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
46 | writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
47 | writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
48 | writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
49 | writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
50 | fill(value: any, offset?: number, end?: number): this;
|
51 | indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
52 | lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
53 | includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
54 |
|
55 | |
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | constructor (str: string, encoding?: string);
|
62 | /**
|
63 | * Allocates a new buffer of {size} octets.
|
64 | *
|
65 | * @param size count of octets to allocate.
|
66 | */
|
67 | constructor (size: number);
|
68 | /**
|
69 | * Allocates a new buffer containing the given {array} of octets.
|
70 | *
|
71 | * @param array The octets to store.
|
72 | */
|
73 | constructor (array: Uint8Array);
|
74 | /**
|
75 | * Produces a Buffer backed by the same allocated memory as
|
76 | * the given {ArrayBuffer}.
|
77 | *
|
78 | *
|
79 | * @param arrayBuffer The ArrayBuffer with which to share memory.
|
80 | */
|
81 | constructor (arrayBuffer: ArrayBuffer);
|
82 | /**
|
83 | * Allocates a new buffer containing the given {array} of octets.
|
84 | *
|
85 | * @param array The octets to store.
|
86 | */
|
87 | constructor (array: any[]);
|
88 | /**
|
89 | * Copies the passed {buffer} data onto a new {Buffer} instance.
|
90 | *
|
91 | * @param buffer The buffer to copy.
|
92 | */
|
93 | constructor (buffer: Buffer);
|
94 | prototype: Buffer;
|
95 | /**
|
96 | * Allocates a new Buffer using an {array} of octets.
|
97 | *
|
98 | * @param array
|
99 | */
|
100 | static from(array: any[]): Buffer;
|
101 | |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
112 | |
113 |
|
114 |
|
115 |
|
116 |
|
117 | static from(buffer: Buffer): Buffer;
|
118 | |
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | static from(str: string, encoding?: string): Buffer;
|
126 | |
127 |
|
128 |
|
129 |
|
130 |
|
131 | static isBuffer(obj: any): obj is Buffer;
|
132 | |
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | static isEncoding(encoding: string): boolean;
|
139 | |
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 | static byteLength(string: string, encoding?: string): number;
|
147 | |
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 | static concat(list: Buffer[], totalLength?: number): Buffer;
|
159 | |
160 |
|
161 |
|
162 | static compare(buf1: Buffer, buf2: Buffer): number;
|
163 | |
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
172 | |
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | static allocUnsafe(size: number): Buffer;
|
179 | |
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | static allocUnsafeSlow(size: number): Buffer;
|
186 | }
|
187 | } |
\ | No newline at end of file |