@types/node 12.6.7 → 12.7.1
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.
- node/README.md +2 -2
- node/buffer.d.ts +1 -1
- node/child_process.d.ts +3 -3
- node/crypto.d.ts +1 -1
- node/dgram.d.ts +2 -2
- node/dns.d.ts +3 -3
- node/fs.d.ts +5 -5
- node/globals.d.ts +109 -100
- node/http.d.ts +91 -0
- node/http2.d.ts +7 -7
- node/index.d.ts +2 -1
- node/inspector.d.ts +1469 -1692
- node/net.d.ts +4 -4
- node/package.json +7 -2
- node/readline.d.ts +19 -5
- node/string_decoder.d.ts +2 -4
- node/tls.d.ts +2 -2
- node/tty.d.ts +18 -3
- node/zlib.d.ts +2 -2
node/README.md
CHANGED
|
@@ -8,9 +8,9 @@ This package contains type definitions for Node.js (http://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
|
|
9
9
|
|
|
10
10
|
Additional Details
|
|
11
|
-
* Last updated: Wed,
|
|
11
|
+
* Last updated: Wed, 07 Aug 2019 21:19:24 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: Buffer, NodeJS, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, queueMicrotask, require, setImmediate, setInterval, setTimeout
|
|
14
14
|
|
|
15
15
|
# Credits
|
|
16
|
-
These definitions were written by Microsoft TypeScript <https://github.com/Microsoft>, DefinitelyTyped <https://github.com/DefinitelyTyped>, Alberto Schiabel <https://github.com/jkomyno>, Alexander T. <https://github.com/a-tarasyuk>, Alvis HT Tang <https://github.com/alvis>, Andrew Makarov <https://github.com/r3nya>, Benjamin Toueg <https://github.com/btoueg>, Bruno Scheufler <https://github.com/brunoscheufler>, Chigozirim C. <https://github.com/smac89>, Christian Vaagland Tellnes <https://github.com/tellnes>, David Junger <https://github.com/touffy>, Deividas Bakanas <https://github.com/DeividasBakanas>, Eugene Y. Q. Shen <https://github.com/eyqs>, Flarna <https://github.com/Flarna>, Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>, Hoàng Văn Khải <https://github.com/KSXGitHub>, Huw <https://github.com/hoo29>, Kelvin Jin <https://github.com/kjin>, Klaus Meinhardt <https://github.com/ajafff>, Lishude <https://github.com/islishude>, Mariusz Wiktorczyk <https://github.com/mwiktorczyk>, Matthieu Sieben <https://github.com/matthieusieben>, Mohsen Azimi <https://github.com/mohsen1>, Nicolas Even <https://github.com/n-e>, Nicolas Voigt <https://github.com/octo-sniffle>, Parambir Singh <https://github.com/parambirs>, Sebastian Silbermann <https://github.com/eps1lon>, Simon Schick <https://github.com/SimonSchick>, Thomas den Hollander <https://github.com/ThomasdenH>, Wilco Bakker <https://github.com/WilcoBakker>, wwwy3y3 <https://github.com/wwwy3y3>, Zane Hannan AU <https://github.com/ZaneHannanAU>, Samuel Ainsworth <https://github.com/samuela>, Kyle Uehlein <https://github.com/kuehlein>, Jordi Oliveras Rovira <https://github.com/j-oliveras>,
|
|
16
|
+
These definitions were written by Microsoft TypeScript <https://github.com/Microsoft>, DefinitelyTyped <https://github.com/DefinitelyTyped>, Alberto Schiabel <https://github.com/jkomyno>, Alexander T. <https://github.com/a-tarasyuk>, Alvis HT Tang <https://github.com/alvis>, Andrew Makarov <https://github.com/r3nya>, Benjamin Toueg <https://github.com/btoueg>, Bruno Scheufler <https://github.com/brunoscheufler>, Chigozirim C. <https://github.com/smac89>, Christian Vaagland Tellnes <https://github.com/tellnes>, David Junger <https://github.com/touffy>, Deividas Bakanas <https://github.com/DeividasBakanas>, Eugene Y. Q. Shen <https://github.com/eyqs>, Flarna <https://github.com/Flarna>, Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>, Hoàng Văn Khải <https://github.com/KSXGitHub>, Huw <https://github.com/hoo29>, Kelvin Jin <https://github.com/kjin>, Klaus Meinhardt <https://github.com/ajafff>, Lishude <https://github.com/islishude>, Mariusz Wiktorczyk <https://github.com/mwiktorczyk>, Matthieu Sieben <https://github.com/matthieusieben>, Mohsen Azimi <https://github.com/mohsen1>, Nicolas Even <https://github.com/n-e>, Nicolas Voigt <https://github.com/octo-sniffle>, Parambir Singh <https://github.com/parambirs>, Sebastian Silbermann <https://github.com/eps1lon>, Simon Schick <https://github.com/SimonSchick>, Thomas den Hollander <https://github.com/ThomasdenH>, Wilco Bakker <https://github.com/WilcoBakker>, wwwy3y3 <https://github.com/wwwy3y3>, Zane Hannan AU <https://github.com/ZaneHannanAU>, Samuel Ainsworth <https://github.com/samuela>, Kyle Uehlein <https://github.com/kuehlein>, Jordi Oliveras Rovira <https://github.com/j-oliveras>, Thanik Bhongbhibhat <https://github.com/bhongy>, and Marcin Kopacz <https://github.com/chyzwar>.
|
node/buffer.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare module "buffer" {
|
|
|
10
10
|
|
|
11
11
|
export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
|
|
12
12
|
|
|
13
|
-
export function transcode(source:
|
|
13
|
+
export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
|
|
14
14
|
|
|
15
15
|
export const SlowBuffer: {
|
|
16
16
|
/** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */
|
node/child_process.d.ts
CHANGED
|
@@ -296,7 +296,7 @@ declare module "child_process" {
|
|
|
296
296
|
|
|
297
297
|
interface SpawnSyncOptions extends CommonOptions {
|
|
298
298
|
argv0?: string; // Not specified in the docs
|
|
299
|
-
input?: string |
|
|
299
|
+
input?: string | NodeJS.TypedArray | DataView;
|
|
300
300
|
stdio?: StdioOptions;
|
|
301
301
|
killSignal?: string | number;
|
|
302
302
|
maxBuffer?: number;
|
|
@@ -328,7 +328,7 @@ declare module "child_process" {
|
|
|
328
328
|
function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
|
329
329
|
|
|
330
330
|
interface ExecSyncOptions extends CommonOptions {
|
|
331
|
-
input?: string |
|
|
331
|
+
input?: string | Uint8Array;
|
|
332
332
|
stdio?: StdioOptions;
|
|
333
333
|
shell?: string;
|
|
334
334
|
killSignal?: string | number;
|
|
@@ -347,7 +347,7 @@ declare module "child_process" {
|
|
|
347
347
|
function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
|
348
348
|
|
|
349
349
|
interface ExecFileSyncOptions extends CommonOptions {
|
|
350
|
-
input?: string |
|
|
350
|
+
input?: string | NodeJS.TypedArray | DataView;
|
|
351
351
|
stdio?: StdioOptions;
|
|
352
352
|
killSignal?: string | number;
|
|
353
353
|
maxBuffer?: number;
|
node/crypto.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ declare module "crypto" {
|
|
|
159
159
|
type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm';
|
|
160
160
|
type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
|
|
161
161
|
|
|
162
|
-
type Binary =
|
|
162
|
+
type Binary = NodeJS.TypedArray | DataView;
|
|
163
163
|
type BinaryLike = string | Binary;
|
|
164
164
|
|
|
165
165
|
type CipherKey = BinaryLike | KeyObject;
|
node/dgram.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ declare module "dgram" {
|
|
|
34
34
|
function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
|
35
35
|
|
|
36
36
|
class Socket extends events.EventEmitter {
|
|
37
|
-
send(msg:
|
|
38
|
-
send(msg:
|
|
37
|
+
send(msg: string | Uint8Array | any[], port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
|
38
|
+
send(msg: string | Uint8Array, offset: number, length: number, port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
|
39
39
|
bind(port?: number, address?: string, callback?: () => void): void;
|
|
40
40
|
bind(port?: number, callback?: () => void): void;
|
|
41
41
|
bind(callback?: () => void): void;
|
node/dns.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ declare module "dns" {
|
|
|
31
31
|
|
|
32
32
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
33
33
|
namespace lookup {
|
|
34
|
-
function __promisify__(hostname: string, options: LookupAllOptions): Promise<
|
|
35
|
-
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<
|
|
36
|
-
function __promisify__(hostname: string, options
|
|
34
|
+
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
|
35
|
+
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
|
36
|
+
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
|
node/fs.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare module "fs" {
|
|
|
8
8
|
*/
|
|
9
9
|
type PathLike = string | Buffer | URL;
|
|
10
10
|
|
|
11
|
-
type BinaryData =
|
|
11
|
+
type BinaryData = DataView | NodeJS.TypedArray;
|
|
12
12
|
class Stats {
|
|
13
13
|
isFile(): boolean;
|
|
14
14
|
isDirectory(): boolean;
|
|
@@ -1847,7 +1847,7 @@ declare module "fs" {
|
|
|
1847
1847
|
* @param length The number of bytes to read.
|
|
1848
1848
|
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1849
1849
|
*/
|
|
1850
|
-
read<TBuffer extends
|
|
1850
|
+
read<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
|
|
1851
1851
|
|
|
1852
1852
|
/**
|
|
1853
1853
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
@@ -1899,7 +1899,7 @@ declare module "fs" {
|
|
|
1899
1899
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1900
1900
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1901
1901
|
*/
|
|
1902
|
-
write<TBuffer extends
|
|
1902
|
+
write<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
|
|
1903
1903
|
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Asynchronously writes `string` to the file.
|
|
@@ -1968,7 +1968,7 @@ declare module "fs" {
|
|
|
1968
1968
|
* @param position The offset from the beginning of the file from which data should be read. If
|
|
1969
1969
|
* `null`, data will be read from the current position.
|
|
1970
1970
|
*/
|
|
1971
|
-
function read<TBuffer extends
|
|
1971
|
+
function read<TBuffer extends Uint8Array>(
|
|
1972
1972
|
handle: FileHandle,
|
|
1973
1973
|
buffer: TBuffer,
|
|
1974
1974
|
offset?: number | null,
|
|
@@ -1986,7 +1986,7 @@ declare module "fs" {
|
|
|
1986
1986
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1987
1987
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1988
1988
|
*/
|
|
1989
|
-
function write<TBuffer extends
|
|
1989
|
+
function write<TBuffer extends Uint8Array>(
|
|
1990
1990
|
handle: FileHandle,
|
|
1991
1991
|
buffer: TBuffer,
|
|
1992
1992
|
offset?: number | null,
|
node/globals.d.ts
CHANGED
|
@@ -238,81 +238,9 @@ declare var exports: any;
|
|
|
238
238
|
|
|
239
239
|
// Buffer class
|
|
240
240
|
type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
|
241
|
-
|
|
241
|
+
|
|
242
|
+
interface Buffer {
|
|
242
243
|
constructor: typeof Buffer;
|
|
243
|
-
write(string: string, encoding?: BufferEncoding): number;
|
|
244
|
-
write(string: string, offset: number, encoding?: BufferEncoding): number;
|
|
245
|
-
write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
|
|
246
|
-
toString(encoding?: string, start?: number, end?: number): string;
|
|
247
|
-
toJSON(): { type: 'Buffer', data: number[] };
|
|
248
|
-
equals(otherBuffer: Uint8Array): boolean;
|
|
249
|
-
compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
250
|
-
copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
251
|
-
/**
|
|
252
|
-
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
|
253
|
-
*
|
|
254
|
-
* This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
|
|
255
|
-
*
|
|
256
|
-
* @param begin Where the new `Buffer` will start. Default: `0`.
|
|
257
|
-
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
|
258
|
-
*/
|
|
259
|
-
slice(begin?: number, end?: number): Buffer;
|
|
260
|
-
/**
|
|
261
|
-
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
|
262
|
-
*
|
|
263
|
-
* This method is compatible with `Uint8Array#subarray()`.
|
|
264
|
-
*
|
|
265
|
-
* @param begin Where the new `Buffer` will start. Default: `0`.
|
|
266
|
-
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
|
267
|
-
*/
|
|
268
|
-
subarray(begin?: number, end?: number): Buffer;
|
|
269
|
-
writeUIntLE(value: number, offset: number, byteLength: number): number;
|
|
270
|
-
writeUIntBE(value: number, offset: number, byteLength: number): number;
|
|
271
|
-
writeIntLE(value: number, offset: number, byteLength: number): number;
|
|
272
|
-
writeIntBE(value: number, offset: number, byteLength: number): number;
|
|
273
|
-
readUIntLE(offset: number, byteLength: number): number;
|
|
274
|
-
readUIntBE(offset: number, byteLength: number): number;
|
|
275
|
-
readIntLE(offset: number, byteLength: number): number;
|
|
276
|
-
readIntBE(offset: number, byteLength: number): number;
|
|
277
|
-
readUInt8(offset: number): number;
|
|
278
|
-
readUInt16LE(offset: number): number;
|
|
279
|
-
readUInt16BE(offset: number): number;
|
|
280
|
-
readUInt32LE(offset: number): number;
|
|
281
|
-
readUInt32BE(offset: number): number;
|
|
282
|
-
readInt8(offset: number): number;
|
|
283
|
-
readInt16LE(offset: number): number;
|
|
284
|
-
readInt16BE(offset: number): number;
|
|
285
|
-
readInt32LE(offset: number): number;
|
|
286
|
-
readInt32BE(offset: number): number;
|
|
287
|
-
readFloatLE(offset: number): number;
|
|
288
|
-
readFloatBE(offset: number): number;
|
|
289
|
-
readDoubleLE(offset: number): number;
|
|
290
|
-
readDoubleBE(offset: number): number;
|
|
291
|
-
reverse(): this;
|
|
292
|
-
swap16(): Buffer;
|
|
293
|
-
swap32(): Buffer;
|
|
294
|
-
swap64(): Buffer;
|
|
295
|
-
writeUInt8(value: number, offset: number): number;
|
|
296
|
-
writeUInt16LE(value: number, offset: number): number;
|
|
297
|
-
writeUInt16BE(value: number, offset: number): number;
|
|
298
|
-
writeUInt32LE(value: number, offset: number): number;
|
|
299
|
-
writeUInt32BE(value: number, offset: number): number;
|
|
300
|
-
writeInt8(value: number, offset: number): number;
|
|
301
|
-
writeInt16LE(value: number, offset: number): number;
|
|
302
|
-
writeInt16BE(value: number, offset: number): number;
|
|
303
|
-
writeInt32LE(value: number, offset: number): number;
|
|
304
|
-
writeInt32BE(value: number, offset: number): number;
|
|
305
|
-
writeFloatLE(value: number, offset: number): number;
|
|
306
|
-
writeFloatBE(value: number, offset: number): number;
|
|
307
|
-
writeDoubleLE(value: number, offset: number): number;
|
|
308
|
-
writeDoubleBE(value: number, offset: number): number;
|
|
309
|
-
fill(value: any, offset?: number, end?: number): this;
|
|
310
|
-
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
311
|
-
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
312
|
-
entries(): IterableIterator<[number, number]>;
|
|
313
|
-
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
|
314
|
-
keys(): IterableIterator<number>;
|
|
315
|
-
values(): IterableIterator<number>;
|
|
316
244
|
}
|
|
317
245
|
|
|
318
246
|
/**
|
|
@@ -320,7 +248,7 @@ interface Buffer extends Uint8Array {
|
|
|
320
248
|
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
|
321
249
|
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
322
250
|
*/
|
|
323
|
-
declare
|
|
251
|
+
declare class Buffer extends Uint8Array {
|
|
324
252
|
/**
|
|
325
253
|
* Allocates a new buffer containing the given {str}.
|
|
326
254
|
*
|
|
@@ -328,21 +256,21 @@ declare const Buffer: {
|
|
|
328
256
|
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
329
257
|
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
|
330
258
|
*/
|
|
331
|
-
|
|
259
|
+
constructor(str: string, encoding?: BufferEncoding);
|
|
332
260
|
/**
|
|
333
261
|
* Allocates a new buffer of {size} octets.
|
|
334
262
|
*
|
|
335
263
|
* @param size count of octets to allocate.
|
|
336
264
|
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
|
337
265
|
*/
|
|
338
|
-
|
|
266
|
+
constructor(size: number);
|
|
339
267
|
/**
|
|
340
268
|
* Allocates a new buffer containing the given {array} of octets.
|
|
341
269
|
*
|
|
342
270
|
* @param array The octets to store.
|
|
343
271
|
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
344
272
|
*/
|
|
345
|
-
|
|
273
|
+
constructor(array: Uint8Array);
|
|
346
274
|
/**
|
|
347
275
|
* Produces a Buffer backed by the same allocated memory as
|
|
348
276
|
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
|
@@ -351,22 +279,21 @@ declare const Buffer: {
|
|
|
351
279
|
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
352
280
|
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
|
353
281
|
*/
|
|
354
|
-
|
|
282
|
+
constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
|
|
355
283
|
/**
|
|
356
284
|
* Allocates a new buffer containing the given {array} of octets.
|
|
357
285
|
*
|
|
358
286
|
* @param array The octets to store.
|
|
359
287
|
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
|
360
288
|
*/
|
|
361
|
-
|
|
289
|
+
constructor(array: any[]);
|
|
362
290
|
/**
|
|
363
291
|
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
364
292
|
*
|
|
365
293
|
* @param buffer The buffer to copy.
|
|
366
294
|
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
|
367
295
|
*/
|
|
368
|
-
|
|
369
|
-
prototype: Buffer;
|
|
296
|
+
constructor(buffer: Buffer);
|
|
370
297
|
/**
|
|
371
298
|
* When passed a reference to the .buffer property of a TypedArray instance,
|
|
372
299
|
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
|
@@ -375,37 +302,37 @@ declare const Buffer: {
|
|
|
375
302
|
*
|
|
376
303
|
* @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
|
|
377
304
|
*/
|
|
378
|
-
from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
|
305
|
+
static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
|
379
306
|
/**
|
|
380
307
|
* Creates a new Buffer using the passed {data}
|
|
381
308
|
* @param data data to create a new Buffer
|
|
382
309
|
*/
|
|
383
|
-
from(data: number[]): Buffer;
|
|
384
|
-
from(data: Uint8Array): Buffer;
|
|
310
|
+
static from(data: number[]): Buffer;
|
|
311
|
+
static from(data: Uint8Array): Buffer;
|
|
385
312
|
/**
|
|
386
313
|
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
387
314
|
* If provided, the {encoding} parameter identifies the character encoding.
|
|
388
315
|
* If not provided, {encoding} defaults to 'utf8'.
|
|
389
316
|
*/
|
|
390
|
-
from(str: string, encoding?: BufferEncoding): Buffer;
|
|
317
|
+
static from(str: string, encoding?: BufferEncoding): Buffer;
|
|
391
318
|
/**
|
|
392
319
|
* Creates a new Buffer using the passed {data}
|
|
393
320
|
* @param values to create a new Buffer
|
|
394
321
|
*/
|
|
395
|
-
of(...items: number[]): Buffer;
|
|
322
|
+
static of(...items: number[]): Buffer;
|
|
396
323
|
/**
|
|
397
324
|
* Returns true if {obj} is a Buffer
|
|
398
325
|
*
|
|
399
326
|
* @param obj object to test.
|
|
400
327
|
*/
|
|
401
|
-
isBuffer(obj: any): obj is Buffer;
|
|
328
|
+
static isBuffer(obj: any): obj is Buffer;
|
|
402
329
|
/**
|
|
403
330
|
* Returns true if {encoding} is a valid encoding argument.
|
|
404
331
|
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
405
332
|
*
|
|
406
333
|
* @param encoding string to test.
|
|
407
334
|
*/
|
|
408
|
-
isEncoding(encoding: string): encoding is BufferEncoding;
|
|
335
|
+
static isEncoding(encoding: string): encoding is BufferEncoding;
|
|
409
336
|
/**
|
|
410
337
|
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
|
411
338
|
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
|
@@ -413,7 +340,7 @@ declare const Buffer: {
|
|
|
413
340
|
* @param string string to test.
|
|
414
341
|
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
|
415
342
|
*/
|
|
416
|
-
byteLength(
|
|
343
|
+
static byteLength(
|
|
417
344
|
string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer,
|
|
418
345
|
encoding?: BufferEncoding
|
|
419
346
|
): number;
|
|
@@ -428,11 +355,11 @@ declare const Buffer: {
|
|
|
428
355
|
* @param totalLength Total length of the buffers when concatenated.
|
|
429
356
|
* 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.
|
|
430
357
|
*/
|
|
431
|
-
concat(list: Uint8Array[], totalLength?: number): Buffer;
|
|
358
|
+
static concat(list: Uint8Array[], totalLength?: number): Buffer;
|
|
432
359
|
/**
|
|
433
360
|
* The same as buf1.compare(buf2).
|
|
434
361
|
*/
|
|
435
|
-
compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
|
362
|
+
static compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
|
436
363
|
/**
|
|
437
364
|
* Allocates a new buffer of {size} octets.
|
|
438
365
|
*
|
|
@@ -441,26 +368,108 @@ declare const Buffer: {
|
|
|
441
368
|
* If parameter is omitted, buffer will be filled with zeros.
|
|
442
369
|
* @param encoding encoding used for call to buf.fill while initalizing
|
|
443
370
|
*/
|
|
444
|
-
alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
|
|
371
|
+
static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
|
|
445
372
|
/**
|
|
446
373
|
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
|
447
374
|
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
448
375
|
*
|
|
449
376
|
* @param size count of octets to allocate
|
|
450
377
|
*/
|
|
451
|
-
allocUnsafe(size: number): Buffer;
|
|
378
|
+
static allocUnsafe(size: number): Buffer;
|
|
452
379
|
/**
|
|
453
380
|
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
|
454
381
|
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
455
382
|
*
|
|
456
383
|
* @param size count of octets to allocate
|
|
457
384
|
*/
|
|
458
|
-
allocUnsafeSlow(size: number): Buffer;
|
|
385
|
+
static allocUnsafeSlow(size: number): Buffer;
|
|
459
386
|
/**
|
|
460
387
|
* This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
|
|
461
388
|
*/
|
|
462
|
-
poolSize: number;
|
|
463
|
-
|
|
389
|
+
static poolSize: number;
|
|
390
|
+
|
|
391
|
+
write(string: string, encoding?: BufferEncoding): number;
|
|
392
|
+
write(string: string, offset: number, encoding?: BufferEncoding): number;
|
|
393
|
+
write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
|
|
394
|
+
toString(encoding?: string, start?: number, end?: number): string;
|
|
395
|
+
toJSON(): { type: 'Buffer'; data: number[] };
|
|
396
|
+
equals(otherBuffer: Uint8Array): boolean;
|
|
397
|
+
compare(
|
|
398
|
+
otherBuffer: Uint8Array,
|
|
399
|
+
targetStart?: number,
|
|
400
|
+
targetEnd?: number,
|
|
401
|
+
sourceStart?: number,
|
|
402
|
+
sourceEnd?: number
|
|
403
|
+
): number;
|
|
404
|
+
copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
405
|
+
/**
|
|
406
|
+
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
|
407
|
+
*
|
|
408
|
+
* This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
|
|
409
|
+
*
|
|
410
|
+
* @param begin Where the new `Buffer` will start. Default: `0`.
|
|
411
|
+
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
|
412
|
+
*/
|
|
413
|
+
slice(begin?: number, end?: number): Buffer;
|
|
414
|
+
/**
|
|
415
|
+
* Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
|
|
416
|
+
*
|
|
417
|
+
* This method is compatible with `Uint8Array#subarray()`.
|
|
418
|
+
*
|
|
419
|
+
* @param begin Where the new `Buffer` will start. Default: `0`.
|
|
420
|
+
* @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
|
|
421
|
+
*/
|
|
422
|
+
subarray(begin?: number, end?: number): Buffer;
|
|
423
|
+
writeUIntLE(value: number, offset: number, byteLength: number): number;
|
|
424
|
+
writeUIntBE(value: number, offset: number, byteLength: number): number;
|
|
425
|
+
writeIntLE(value: number, offset: number, byteLength: number): number;
|
|
426
|
+
writeIntBE(value: number, offset: number, byteLength: number): number;
|
|
427
|
+
readUIntLE(offset: number, byteLength: number): number;
|
|
428
|
+
readUIntBE(offset: number, byteLength: number): number;
|
|
429
|
+
readIntLE(offset: number, byteLength: number): number;
|
|
430
|
+
readIntBE(offset: number, byteLength: number): number;
|
|
431
|
+
readUInt8(offset: number): number;
|
|
432
|
+
readUInt16LE(offset: number): number;
|
|
433
|
+
readUInt16BE(offset: number): number;
|
|
434
|
+
readUInt32LE(offset: number): number;
|
|
435
|
+
readUInt32BE(offset: number): number;
|
|
436
|
+
readInt8(offset: number): number;
|
|
437
|
+
readInt16LE(offset: number): number;
|
|
438
|
+
readInt16BE(offset: number): number;
|
|
439
|
+
readInt32LE(offset: number): number;
|
|
440
|
+
readInt32BE(offset: number): number;
|
|
441
|
+
readFloatLE(offset: number): number;
|
|
442
|
+
readFloatBE(offset: number): number;
|
|
443
|
+
readDoubleLE(offset: number): number;
|
|
444
|
+
readDoubleBE(offset: number): number;
|
|
445
|
+
reverse(): this;
|
|
446
|
+
swap16(): Buffer;
|
|
447
|
+
swap32(): Buffer;
|
|
448
|
+
swap64(): Buffer;
|
|
449
|
+
writeUInt8(value: number, offset: number): number;
|
|
450
|
+
writeUInt16LE(value: number, offset: number): number;
|
|
451
|
+
writeUInt16BE(value: number, offset: number): number;
|
|
452
|
+
writeUInt32LE(value: number, offset: number): number;
|
|
453
|
+
writeUInt32BE(value: number, offset: number): number;
|
|
454
|
+
writeInt8(value: number, offset: number): number;
|
|
455
|
+
writeInt16LE(value: number, offset: number): number;
|
|
456
|
+
writeInt16BE(value: number, offset: number): number;
|
|
457
|
+
writeInt32LE(value: number, offset: number): number;
|
|
458
|
+
writeInt32BE(value: number, offset: number): number;
|
|
459
|
+
writeFloatLE(value: number, offset: number): number;
|
|
460
|
+
writeFloatBE(value: number, offset: number): number;
|
|
461
|
+
writeDoubleLE(value: number, offset: number): number;
|
|
462
|
+
writeDoubleBE(value: number, offset: number): number;
|
|
463
|
+
|
|
464
|
+
fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
|
465
|
+
|
|
466
|
+
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
467
|
+
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
|
468
|
+
entries(): IterableIterator<[number, number]>;
|
|
469
|
+
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
|
470
|
+
keys(): IterableIterator<number>;
|
|
471
|
+
values(): IterableIterator<number>;
|
|
472
|
+
}
|
|
464
473
|
|
|
465
474
|
/*----------------------------------------------*
|
|
466
475
|
* *
|
|
@@ -626,17 +635,17 @@ declare namespace NodeJS {
|
|
|
626
635
|
isPaused(): boolean;
|
|
627
636
|
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
|
628
637
|
unpipe(destination?: WritableStream): this;
|
|
629
|
-
unshift(chunk: string |
|
|
638
|
+
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
630
639
|
wrap(oldStream: ReadableStream): this;
|
|
631
640
|
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
|
632
641
|
}
|
|
633
642
|
|
|
634
643
|
interface WritableStream extends EventEmitter {
|
|
635
644
|
writable: boolean;
|
|
636
|
-
write(buffer:
|
|
645
|
+
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
637
646
|
write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean;
|
|
638
647
|
end(cb?: () => void): void;
|
|
639
|
-
end(data: string | Uint8Array
|
|
648
|
+
end(data: string | Uint8Array, cb?: () => void): void;
|
|
640
649
|
end(str: string, encoding?: string, cb?: () => void): void;
|
|
641
650
|
}
|
|
642
651
|
|
node/http.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ declare module "http" {
|
|
|
146
146
|
class ServerResponse extends OutgoingMessage {
|
|
147
147
|
statusCode: number;
|
|
148
148
|
statusMessage: string;
|
|
149
|
+
writableFinished: boolean;
|
|
149
150
|
|
|
150
151
|
constructor(req: IncomingMessage);
|
|
151
152
|
|
|
@@ -158,6 +159,16 @@ declare module "http" {
|
|
|
158
159
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
interface InformationEvent {
|
|
163
|
+
statusCode: number;
|
|
164
|
+
statusMessage: string;
|
|
165
|
+
httpVersion: string;
|
|
166
|
+
httpVersionMajor: number;
|
|
167
|
+
httpVersionMinor: number;
|
|
168
|
+
headers: IncomingHttpHeaders;
|
|
169
|
+
rawHeaders: string[];
|
|
170
|
+
}
|
|
171
|
+
|
|
161
172
|
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77
|
|
162
173
|
class ClientRequest extends OutgoingMessage {
|
|
163
174
|
connection: Socket;
|
|
@@ -172,6 +183,86 @@ declare module "http" {
|
|
|
172
183
|
setTimeout(timeout: number, callback?: () => void): this;
|
|
173
184
|
setNoDelay(noDelay?: boolean): void;
|
|
174
185
|
setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
|
|
186
|
+
|
|
187
|
+
addListener(event: 'abort', listener: () => void): this;
|
|
188
|
+
addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
189
|
+
addListener(event: 'continue', listener: () => void): this;
|
|
190
|
+
addListener(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
191
|
+
addListener(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
192
|
+
addListener(event: 'socket', listener: (socket: Socket) => void): this;
|
|
193
|
+
addListener(event: 'timeout', listener: () => void): this;
|
|
194
|
+
addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
195
|
+
addListener(event: 'close', listener: () => void): this;
|
|
196
|
+
addListener(event: 'drain', listener: () => void): this;
|
|
197
|
+
addListener(event: 'error', listener: (err: Error) => void): this;
|
|
198
|
+
addListener(event: 'finish', listener: () => void): this;
|
|
199
|
+
addListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
|
200
|
+
addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
|
201
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
202
|
+
|
|
203
|
+
on(event: 'abort', listener: () => void): this;
|
|
204
|
+
on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
205
|
+
on(event: 'continue', listener: () => void): this;
|
|
206
|
+
on(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
207
|
+
on(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
208
|
+
on(event: 'socket', listener: (socket: Socket) => void): this;
|
|
209
|
+
on(event: 'timeout', listener: () => void): this;
|
|
210
|
+
on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
211
|
+
on(event: 'close', listener: () => void): this;
|
|
212
|
+
on(event: 'drain', listener: () => void): this;
|
|
213
|
+
on(event: 'error', listener: (err: Error) => void): this;
|
|
214
|
+
on(event: 'finish', listener: () => void): this;
|
|
215
|
+
on(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
|
216
|
+
on(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
|
217
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
218
|
+
|
|
219
|
+
once(event: 'abort', listener: () => void): this;
|
|
220
|
+
once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
221
|
+
once(event: 'continue', listener: () => void): this;
|
|
222
|
+
once(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
223
|
+
once(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
224
|
+
once(event: 'socket', listener: (socket: Socket) => void): this;
|
|
225
|
+
once(event: 'timeout', listener: () => void): this;
|
|
226
|
+
once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
227
|
+
once(event: 'close', listener: () => void): this;
|
|
228
|
+
once(event: 'drain', listener: () => void): this;
|
|
229
|
+
once(event: 'error', listener: (err: Error) => void): this;
|
|
230
|
+
once(event: 'finish', listener: () => void): this;
|
|
231
|
+
once(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
|
232
|
+
once(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
|
233
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
234
|
+
|
|
235
|
+
prependListener(event: 'abort', listener: () => void): this;
|
|
236
|
+
prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
237
|
+
prependListener(event: 'continue', listener: () => void): this;
|
|
238
|
+
prependListener(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
239
|
+
prependListener(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
240
|
+
prependListener(event: 'socket', listener: (socket: Socket) => void): this;
|
|
241
|
+
prependListener(event: 'timeout', listener: () => void): this;
|
|
242
|
+
prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
243
|
+
prependListener(event: 'close', listener: () => void): this;
|
|
244
|
+
prependListener(event: 'drain', listener: () => void): this;
|
|
245
|
+
prependListener(event: 'error', listener: (err: Error) => void): this;
|
|
246
|
+
prependListener(event: 'finish', listener: () => void): this;
|
|
247
|
+
prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
|
248
|
+
prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
|
249
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
250
|
+
|
|
251
|
+
prependOnceListener(event: 'abort', listener: () => void): this;
|
|
252
|
+
prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
253
|
+
prependOnceListener(event: 'continue', listener: () => void): this;
|
|
254
|
+
prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this;
|
|
255
|
+
prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this;
|
|
256
|
+
prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this;
|
|
257
|
+
prependOnceListener(event: 'timeout', listener: () => void): this;
|
|
258
|
+
prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
|
|
259
|
+
prependOnceListener(event: 'close', listener: () => void): this;
|
|
260
|
+
prependOnceListener(event: 'drain', listener: () => void): this;
|
|
261
|
+
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
262
|
+
prependOnceListener(event: 'finish', listener: () => void): this;
|
|
263
|
+
prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
|
264
|
+
prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
|
265
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
175
266
|
}
|
|
176
267
|
|
|
177
268
|
class IncomingMessage extends stream.Readable {
|
node/http2.d.ts
CHANGED
|
@@ -583,7 +583,7 @@ declare module "http2" {
|
|
|
583
583
|
}
|
|
584
584
|
|
|
585
585
|
export class Http2ServerRequest extends stream.Readable {
|
|
586
|
-
|
|
586
|
+
constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: string[]);
|
|
587
587
|
|
|
588
588
|
readonly aborted: boolean;
|
|
589
589
|
readonly authority: string;
|
|
@@ -651,13 +651,13 @@ declare module "http2" {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
export class Http2ServerResponse extends stream.Stream {
|
|
654
|
-
|
|
654
|
+
constructor(stream: ServerHttp2Stream);
|
|
655
655
|
|
|
656
656
|
addTrailers(trailers: OutgoingHttpHeaders): void;
|
|
657
657
|
readonly connection: net.Socket | tls.TLSSocket;
|
|
658
658
|
end(callback?: () => void): void;
|
|
659
|
-
end(data: string |
|
|
660
|
-
end(data: string |
|
|
659
|
+
end(data: string | Uint8Array, callback?: () => void): void;
|
|
660
|
+
end(data: string | Uint8Array, encoding: string, callback?: () => void): void;
|
|
661
661
|
readonly finished: boolean;
|
|
662
662
|
getHeader(name: string): string;
|
|
663
663
|
getHeaderNames(): string[];
|
|
@@ -672,8 +672,8 @@ declare module "http2" {
|
|
|
672
672
|
statusCode: number;
|
|
673
673
|
statusMessage: '';
|
|
674
674
|
readonly stream: ServerHttp2Stream;
|
|
675
|
-
write(chunk: string |
|
|
676
|
-
write(chunk: string |
|
|
675
|
+
write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
|
|
676
|
+
write(chunk: string | Uint8Array, encoding: string, callback?: (err: Error) => void): boolean;
|
|
677
677
|
writeContinue(): void;
|
|
678
678
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
|
679
679
|
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
|
|
@@ -943,7 +943,7 @@ declare module "http2" {
|
|
|
943
943
|
|
|
944
944
|
export function getDefaultSettings(): Settings;
|
|
945
945
|
export function getPackedSettings(settings: Settings): Buffer;
|
|
946
|
-
export function getUnpackedSettings(buf:
|
|
946
|
+
export function getUnpackedSettings(buf: Uint8Array): Settings;
|
|
947
947
|
|
|
948
948
|
export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
|
|
949
949
|
export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
|