Socket
Socket
Sign inDemoInstall

@types/readable-stream

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/readable-stream - npm Package Compare versions

Comparing version 2.3.9 to 2.3.15

348

readable-stream/index.d.ts

@@ -10,3 +10,2 @@ // Type definitions for readable-stream 2.3

import * as stream from "stream";
import * as SafeBuffer from "safe-buffer";

@@ -20,3 +19,129 @@

declare class _Readable extends stream.Readable {
interface _IEventEmitter {
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeAllListeners(event?: string | symbol): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
// tslint:disable-next-line:ban-types
listeners(eventName: string | symbol): Function[];
// tslint:disable-next-line:ban-types
rawListeners(eventName: string | symbol): Function[];
listenerCount(eventName: string | symbol): number;
eventNames(): Array<string | symbol>;
}
interface _IReadable extends _IEventEmitter {
_read(size: number): void;
read(size?: number): any;
setEncoding(encoding: string): this;
pause(): this;
resume(): this;
isPaused(): boolean;
unpipe(destination?: _Readable.Writable): this;
unshift(chunk: any): void;
wrap(oldStream: _Readable.Readable): this;
push(chunk: any, encoding?: string): boolean;
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
destroy(error?: Error): this;
}
declare class _Readable implements _IReadable {
readable: boolean;
readonly readableFlowing: boolean | null;
readonly readableHighWaterMark: number;
readonly readableLength: number;
readonly closed: boolean;
readonly errored: Error | null;
_read(size: number): void;
read(size?: number): any;
setEncoding(encoding: string): this;
pause(): this;
resume(): this;
isPaused(): boolean;
unpipe(destination?: _Readable.Writable): this;
unshift(chunk: any): void;
wrap(oldStream: _Readable.Readable): this;
push(chunk: any, encoding?: string): boolean;
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
destroy(error?: Error): this;
/**
* Event emitter
* The defined events on documents including:
* 1. close
* 2. data
* 3. end
* 4. readable
* 5. error
*/
addListener(event: "close", listener: () => void): this;
addListener(event: "data", listener: (chunk: any) => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "readable", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "data", chunk: any): boolean;
emit(event: "end"): boolean;
emit(event: "readable"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "data", listener: (chunk: any) => void): this;
on(event: "end", listener: () => void): this;
on(event: "readable", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "data", listener: (chunk: any) => void): this;
once(event: "end", listener: () => void): this;
once(event: "readable", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "data", listener: (chunk: any) => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "readable", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "data", listener: (chunk: any) => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "readable", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "close", listener: () => void): this;
removeListener(event: "data", listener: (chunk: any) => void): this;
removeListener(event: "end", listener: () => void): this;
removeListener(event: "readable", listener: () => void): this;
removeListener(event: "error", listener: (err: Error) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeAllListeners(event?: string | symbol): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
// tslint:disable-next-line:ban-types
listeners(eventName: string | symbol): Function[];
// tslint:disable-next-line:ban-types
rawListeners(eventName: string | symbol): Function[];
listenerCount(eventName: string | symbol): number;
eventNames(): Array<string | symbol>;
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
// static ReadableState: _Readable.ReadableState;

@@ -28,3 +153,2 @@ _readableState: _Readable.ReadableState;

destroy(err?: Error, callback?: (error: Error | null) => void): this;
_undestroy(): void;

@@ -61,5 +185,5 @@ }

type DuplexOptions = ReadableOptions & WritableOptions & {
allowHalfOpen?: boolean;
readable?: boolean;
writable?: boolean;
allowHalfOpen?: boolean | undefined;
readable?: boolean | undefined;
writable?: boolean | undefined;
read?(this: Duplex, size: number): void;

@@ -72,3 +196,5 @@ write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;

class Duplex extends Writable implements /*extends*/_Readable, stream.Duplex {
type _IDuplex = _IReadable & _IWritable;
class Duplex extends _Writable implements _IDuplex, /*extends*/_Readable, Duplex {
/**

@@ -90,2 +216,9 @@ * This is a dummy function required to retain type compatibility to node.

readonly writableObjectMode: boolean;
readonly readableAborted: never;
readonly readableDidRead: never;
readonly writableEnded: never;
readonly writableFinished: never;
readonly writableCorked: never;
_readableState: ReadableState;

@@ -99,9 +232,9 @@

isPaused(): boolean;
unpipe(dest?: NodeJS.WritableStream): this;
unpipe(dest?: Writable): this;
unshift(chunk: any): boolean;
wrap(oldStream: NodeJS.ReadableStream): this;
wrap(oldStream: Readable): this;
push(chunk: any, encoding?: BufferEncoding): boolean;
_destroy(err: Error | null, callback: (error: Error | null) => void): void;
destroy(err?: Error, callback?: (error: Error | null) => void): this;
pipe<S extends NodeJS.WritableStream>(dest: S, pipeOpts?: { end?: boolean }): S;
pipe<S extends _IWritable>(dest: S, pipeOpts?: { end?: boolean | undefined }): S;
addListener(ev: string | symbol, fn: (...args: any[]) => void): this;

@@ -118,3 +251,3 @@ on(ev: string | symbol, fn: (...args: any[]) => void): this;

// ==== _stream_passthrough ====
class PassThrough extends Transform implements stream.PassThrough {
class PassThrough extends Transform {
constructor(options?: TransformOptions);

@@ -127,8 +260,8 @@

interface ReadableStateOptions {
defaultEncoding?: BufferEncoding;
encoding?: BufferEncoding;
highWaterMark?: number;
objectMode?: boolean;
readableObjectMode?: boolean;
readableHighWaterMark?: number;
defaultEncoding?: BufferEncoding | undefined;
encoding?: BufferEncoding | undefined;
highWaterMark?: number | undefined;
objectMode?: boolean | undefined;
readableObjectMode?: boolean | undefined;
readableHighWaterMark?: number | undefined;
}

@@ -141,3 +274,3 @@

length: number;
pipes: any; // NodeJS.WritableStream | any[]; // TODO
pipes: any;
pipesCount: number;

@@ -164,22 +297,34 @@ flowing: any;

type ReadableOptions = ReadableStateOptions & {
read?(this: _Readable, size: number): void;
destroy?(this: _Readable, error: Error | null, callback: (error: Error | null) => void): void;
read?(this: _IReadable, size: number): void;
destroy?(this: _IReadable, error: Error | null, callback: (error: Error | null) => void): void;
};
class Readable extends _Readable {
readonly readableAborted: never;
readonly readableDidRead: never;
readonly readableEncoding: never;
readonly readableEnded: never;
readonly readableObjectMode: never;
constructor(options?: ReadableOptions);
pipe<T extends _IWritable>(destination: T, options?: { end?: boolean | undefined; }): T;
}
// ==== _stream_transform ====
type TransformOptions = DuplexOptions & {
read?(this: Transform, size: number): void;
write?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
writev?(this: Transform, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
final?(this: Transform, callback: (error?: Error | null) => void): void;
destroy?(this: Transform, error: Error | null, callback: (error: Error | null) => void): void;
transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: (error?: Error, data?: any) => void): void;
flush?(this: Transform, callback: (er: any, data: any) => void): void;
type TransformOptions = ReadableOptions & WritableOptions & {
read?(this: _ITransform, size: number): void;
write?(this: _ITransform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
writev?(this: _ITransform, chunks: Array<{ chunk: any, encoding: BufferEncoding }>, callback: (error?: Error | null) => void): void;
final?(this: _ITransform, callback: (error?: Error | null) => void): void;
destroy?(this: _ITransform, error: Error | null, callback: (error: Error | null) => void): void;
transform?(this: _ITransform, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null, data?: any) => void): void;
flush?(callback: (error?: Error | null, data?: any) => void): void;
};
class Transform extends Duplex implements stream.Transform {
interface _ITransform extends _IDuplex {
_transform(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null, data?: any) => void): void;
_flush(callback: (error?: Error | null, data?: any) => void): void;
}
class Transform extends Duplex {
_transformState: {

@@ -196,4 +341,4 @@ afterTransform: (this: Transform, er: any, data: any) => void | boolean;

_transform(chunk: any, encoding: BufferEncoding, callback: (error?: Error, data?: any) => void): void;
_flush(callback: (error?: Error, data?: any) => void): void;
_transform(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null, data?: any) => void): void;
_flush(callback: (error?: Error | null, data?: any) => void): void;
}

@@ -217,8 +362,8 @@

interface WritableStateOptions {
decodeStrings?: boolean;
defaultEncoding?: BufferEncoding;
highWaterMark?: number;
objectMode?: boolean;
writableObjectMode?: boolean;
writableHighWaterMark?: number;
decodeStrings?: boolean | undefined;
defaultEncoding?: BufferEncoding | undefined;
highWaterMark?: number | undefined;
objectMode?: boolean | undefined;
writableObjectMode?: boolean | undefined;
writableHighWaterMark?: number | undefined;
}

@@ -260,9 +405,105 @@

type WritableOptions = WritableStateOptions & {
write?(this: Writable, chunk: any, encoding: BufferEncoding | string, callback: (error?: Error | null) => void): void;
writev?(this: Writable, chunk: ArrayLike<{ chunk: any; encoding: BufferEncoding | string }>, callback: (error?: Error | null) => void): void;
destroy?(this: Writable, error: Error | null, callback: (error: Error | null) => void): void;
final?(this: Writable, callback: (error?: Error | null) => void): void;
write?(this: _IWritable, chunk: any, encoding: BufferEncoding | string, callback: (error?: Error | null) => void): void;
writev?(this: _IWritable, chunk: ArrayLike<{ chunk: any; encoding: BufferEncoding | string }>, callback: (error?: Error | null) => void): void;
destroy?(this: _IWritable, error: Error | null, callback: (error: Error | null) => void): void;
final?(this: _IWritable, callback: (error?: Error | null) => void): void;
};
class Writable extends stream.Writable {
interface _IWritable extends _IEventEmitter {
writable: boolean;
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean;
end(cb?: () => void): this;
end(data: string | Uint8Array, cb?: () => void): this;
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
}
class _Writable extends Stream implements _IWritable {
writable: boolean;
readonly writableHighWaterMark: number;
readonly writableLength: number;
readonly closed: boolean;
readonly errored: Error | null;
readonly writableNeedDrain: boolean;
constructor(opts?: WritableOptions);
_write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
_writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
_final(callback: (error?: Error | null) => void): void;
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean;
setDefaultEncoding(encoding: string): this;
end(cb?: () => void): this;
end(chunk: any, cb?: () => void): this;
end(chunk: any, encoding?: string, cb?: () => void): this;
cork(): void;
uncork(): void;
destroy(error?: Error): this;
/**
* Event emitter
* The defined events on documents including:
* 1. close
* 2. drain
* 3. error
* 4. finish
* 5. pipe
* 6. unpipe
*/
addListener(event: "close", listener: () => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "pipe", listener: (src: Readable) => void): this;
addListener(event: "unpipe", listener: (src: Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "drain"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "finish"): boolean;
emit(event: "pipe", src: Readable): boolean;
emit(event: "unpipe", src: Readable): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "pipe", listener: (src: Readable) => void): this;
on(event: "unpipe", listener: (src: Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "drain", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "pipe", listener: (src: Readable) => void): this;
once(event: "unpipe", listener: (src: Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "pipe", listener: (src: Readable) => void): this;
prependListener(event: "unpipe", listener: (src: Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "close", listener: () => void): this;
removeListener(event: "drain", listener: () => void): this;
removeListener(event: "error", listener: (err: Error) => void): this;
removeListener(event: "finish", listener: () => void): this;
removeListener(event: "pipe", listener: (src: Readable) => void): this;
removeListener(event: "unpipe", listener: (src: Readable) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
// static WritableState: WritableState;

@@ -273,21 +514,18 @@ // private static realHasInstance: (obj: any) => boolean;

constructor(options?: WritableOptions);
destroy(error?: Error, callback?: (error?: Error | null) => void): this;
_undestroy(): void;
}
class Writable extends _Writable {
readonly writableEnded: never;
readonly writableFinished: never;
readonly writableObjectMode: never;
readonly writableCorked: never;
constructor(opts?: WritableOptions);
}
class Stream extends _Readable {
constructor(options?: ReadableOptions);
pipe<T extends _IWritable>(destination: T, options?: { end?: boolean | undefined; }): T;
}
// if (process.env.READABLE_STREAM === 'disable' && Stream)
let NodeBaseExport: stream.Readable & {
Readable: stream.Readable;
Writable: stream.Writable;
Duplex: stream.Duplex;
Transform: stream.Transform;
PassThrough: stream.PassThrough;
Stream: stream;
};
}

@@ -294,0 +532,0 @@

9

readable-stream/package.json
{
"name": "@types/readable-stream",
"version": "2.3.9",
"version": "2.3.15",
"description": "TypeScript definitions for readable-stream",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/readable-stream",
"license": "MIT",

@@ -28,6 +29,6 @@ "contributors": [

"@types/node": "*",
"safe-buffer": "*"
"safe-buffer": "~5.1.1"
},
"typesPublisherContentHash": "3c0690ae963781f75257eed70404d109d812effe85b3877a9c1f57d50c9e0cd8",
"typeScriptVersion": "3.0"
"typesPublisherContentHash": "73a801ff00aa91c2cfb03ebbdc97efaf566a78da79ac6880985abff0618c3a94",
"typeScriptVersion": "4.1"
}

@@ -11,4 +11,4 @@ # Installation

### Additional Details
* Last updated: Fri, 10 Jul 2020 15:37:57 GMT
* Dependencies: [@types/safe-buffer](https://npmjs.com/package/@types/safe-buffer), [@types/node](https://npmjs.com/package/@types/node)
* Last updated: Mon, 31 Oct 2022 08:03:03 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/safe-buffer](https://npmjs.com/package/@types/safe-buffer)
* Global values: `_Readable`

@@ -15,0 +15,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc