source: trip-planner-front/node_modules/safe-buffer/index.d.ts@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 8.5 KB
Line 
1declare 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 * Allocates a new buffer containing the given {str}.
57 *
58 * @param str String to store in buffer.
59 * @param encoding encoding to use, optional. Default is 'utf8'
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 * When passed a reference to the .buffer property of a TypedArray instance,
103 * the newly created Buffer will share the same allocated memory as the TypedArray.
104 * The optional {byteOffset} and {length} arguments specify a memory range
105 * within the {arrayBuffer} that will be shared by the Buffer.
106 *
107 * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
108 * @param byteOffset
109 * @param length
110 */
111 static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
112 /**
113 * Copies the passed {buffer} data onto a new Buffer instance.
114 *
115 * @param buffer
116 */
117 static from(buffer: Buffer): Buffer;
118 /**
119 * Creates a new Buffer containing the given JavaScript string {str}.
120 * If provided, the {encoding} parameter identifies the character encoding.
121 * If not provided, {encoding} defaults to 'utf8'.
122 *
123 * @param str
124 */
125 static from(str: string, encoding?: string): Buffer;
126 /**
127 * Returns true if {obj} is a Buffer
128 *
129 * @param obj object to test.
130 */
131 static isBuffer(obj: any): obj is Buffer;
132 /**
133 * Returns true if {encoding} is a valid encoding argument.
134 * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
135 *
136 * @param encoding string to test.
137 */
138 static isEncoding(encoding: string): boolean;
139 /**
140 * Gives the actual byte length of a string. encoding defaults to 'utf8'.
141 * This is not the same as String.prototype.length since that returns the number of characters in a string.
142 *
143 * @param string string to test.
144 * @param encoding encoding used to evaluate (defaults to 'utf8')
145 */
146 static byteLength(string: string, encoding?: string): number;
147 /**
148 * Returns a buffer which is the result of concatenating all the buffers in the list together.
149 *
150 * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
151 * If the list has exactly one item, then the first item of the list is returned.
152 * If the list has more than one item, then a new Buffer is created.
153 *
154 * @param list An array of Buffer objects to concatenate
155 * @param totalLength Total length of the buffers when concatenated.
156 * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
157 */
158 static concat(list: Buffer[], totalLength?: number): Buffer;
159 /**
160 * The same as buf1.compare(buf2).
161 */
162 static compare(buf1: Buffer, buf2: Buffer): number;
163 /**
164 * Allocates a new buffer of {size} octets.
165 *
166 * @param size count of octets to allocate.
167 * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
168 * If parameter is omitted, buffer will be filled with zeros.
169 * @param encoding encoding used for call to buf.fill while initalizing
170 */
171 static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
172 /**
173 * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
174 * of the newly created Buffer are unknown and may contain sensitive data.
175 *
176 * @param size count of octets to allocate
177 */
178 static allocUnsafe(size: number): Buffer;
179 /**
180 * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
181 * of the newly created Buffer are unknown and may contain sensitive data.
182 *
183 * @param size count of octets to allocate
184 */
185 static allocUnsafeSlow(size: number): Buffer;
186 }
187}
Note: See TracBrowser for help on using the repository browser.