Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions flow-typed/environment/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2459,6 +2459,13 @@ declare class stream$Readable extends stream$Stream {
options?: readableStreamOptions,
): stream$Readable;

static fromWeb(
readableStream: ReadableStream,
options?: readableStreamOptions,
): stream$Readable;

static toWeb(streamReadable: stream$Readable): ReadableStream;

constructor(options?: readableStreamOptions): void;
destroy(error?: Error): this;
isPaused(): boolean;
Expand Down Expand Up @@ -2504,6 +2511,13 @@ type writableStreamOptions = {
...
};
declare class stream$Writable extends stream$Stream {
static fromWeb(
writableStream: WritableStream,
options?: writableStreamOptions,
): stream$Writable;

static toWeb(streamWritable: stream$Writable): WritableStream;

constructor(options?: writableStreamOptions): void;
cork(): void;
destroy(error?: Error): this;
Expand Down Expand Up @@ -2559,6 +2573,21 @@ type duplexStreamOptions = writableStreamOptions &
...
};
declare class stream$Duplex extends stream$Readable mixins stream$Writable {
static fromWeb(
pair: {
readable: ReadableStream,
writable: WritableStream,
...
},
options?: duplexStreamOptions,
): stream$Duplex;

static toWeb(streamDuplex: stream$Duplex): {
readable: ReadableStream,
writable: WritableStream,
...
};

constructor(options?: duplexStreamOptions): void;
}
type transformStreamOptions = duplexStreamOptions & {
Expand Down Expand Up @@ -3402,6 +3431,20 @@ type zlib$brotliOptions = {
...
};

type zlib$zstdOptions = {
flush?: number,
finishFlush?: number,
chunkSize?: number,
params?: {
[number]: boolean | number,
...
},
maxOutputLength?: number,
info?: boolean,
dictionary?: Buffer,
...
};

type zlib$syncFn = (
buffer: Buffer | $TypedArray | DataView | ArrayBuffer | string,
options?: zlib$options,
Expand Down Expand Up @@ -3579,6 +3622,79 @@ declare module 'zlib' {
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number,
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number,
BROTLI_DECODER_ERROR_UNREACHABL: number,

ZSTD_COMPRESS: number,
ZSTD_DECOMPRESS: number,

// Default compression level for zstd streams
ZSTD_CLEVEL_DEFAULT: number,

// Keys for zlib$zstdOptions['params']
ZSTD_c_compressionLevel: number,
ZSTD_c_windowLog: number,
ZSTD_c_hashLog: number,
ZSTD_c_chainLog: number,
ZSTD_c_searchLog: number,
ZSTD_c_minMatch: number,
ZSTD_c_targetLength: number,
ZSTD_c_strategy: number,
ZSTD_c_enableLongDistanceMatching: number,
ZSTD_c_ldmHashLog: number,
ZSTD_c_ldmMinMatch: number,
ZSTD_c_ldmBucketSizeLog: number,
ZSTD_c_ldmHashRateLog: number,
ZSTD_c_contentSizeFlag: number,
ZSTD_c_checksumFlag: number,
ZSTD_c_dictIDFlag: number,
ZSTD_c_nbWorkers: number,
ZSTD_c_jobSize: number,
ZSTD_c_overlapLog: number,

// Flush opereations
ZSTD_e_continue: number,
ZSTD_e_flush: number,
ZSTD_e_end: number,

// Values for the ZSTD_c_strategy paramater
ZSTD_fast: number,
ZSTD_dfast: number,
ZSTD_greedy: number,
ZSTD_lazy: number,
ZSTD_lazy2: number,
ZSTD_btlazy2: number,
ZSTD_btopt: number,
ZSTD_btultra: number,
ZSTD_btultra2: number,

// Error codes
ZSTD_error_no_error: number,
ZSTD_error_GENERIC: number,
ZSTD_error_prefix_unknown: number,
ZSTD_error_version_unsupported: number,
ZSTD_error_frameParameter_unsupported: number,
ZSTD_error_frameParameter_windowTooLarge: number,
ZSTD_error_corruption_detected: number,
ZSTD_error_checksum_wrong: number,
ZSTD_error_literals_headerWrong: number,
ZSTD_error_dictionary_corrupted: number,
ZSTD_error_dictionary_wrong: number,
ZSTD_error_dictionaryCreation_failed: number,
ZSTD_error_parameter_unsupported: number,
ZSTD_error_parameter_combination_unsupported: number,
ZSTD_error_parameter_outOfBound: number,
ZSTD_error_tableLog_tooLarge: number,
ZSTD_error_maxSymbolValue_tooLarge: number,
ZSTD_error_maxSymbolValue_tooSmall: number,
ZSTD_error_stabilityCondition_notRespected: number,
ZSTD_error_stage_wrong: number,
ZSTD_error_init_missing: number,
ZSTD_error_memory_allocation: number,
ZSTD_error_workSpace_tooSmall: number,
ZSTD_error_dstSize_tooSmall: number,
ZSTD_error_srcSize_wrong: number,
ZSTD_error_dstBuffer_null: number,
ZSTD_error_noForwardProgress_destFull: number,
ZSTD_error_noForwardProgress_inputEmpty: number,
...
};
declare var codes: {
Expand All @@ -3598,6 +3714,8 @@ declare module 'zlib' {
}
declare class BrotliCompress extends Zlib {}
declare class BrotliDecompress extends Zlib {}
declare class ZstdCompress extends Zlib {}
declare class ZstdDecompress extends Zlib {}
declare class Deflate extends Zlib {}
declare class Inflate extends Zlib {}
declare class Gzip extends Zlib {}
Expand All @@ -3618,6 +3736,10 @@ declare module 'zlib' {
declare function createGzip(options?: zlib$options): Gzip;
declare function createGunzip(options?: zlib$options): Gunzip;
declare function createUnzip(options?: zlib$options): Unzip;
declare function createZstdCompress(options?: zlib$zstdOptions): ZstdCompress;
declare function createZstdDecompress(
options?: zlib$zstdOptions,
): ZstdDecompress;
declare var brotliCompress: zlib$brotliAsyncFn;
declare var brotliCompressSync: zlib$brotliSyncFn;
declare var brotliDeompress: zlib$brotliAsyncFn;
Expand Down
Loading