@types/whatwg-streams
Advanced tools
Comparing version 0.0.4 to 0.0.5
// Type definitions for Streams API | ||
// Project: https://github.com/whatwg/streams | ||
// Definitions by: Kagami Sascha Rosylight <https://github.com/saschanaz> | ||
// Konstantin Simon Maria Möllers <https://github.com/ksm2> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
export interface ReadableStreamSource { | ||
start?(controller: ReadableStreamDefaultController): void | Promise<void>; | ||
pull?(controller: ReadableStreamDefaultController): void | Promise<void>; | ||
export interface ReadableStreamSource<R = ArrayBufferView> { | ||
start?(controller: ReadableStreamDefaultController<R>): void | Promise<void>; | ||
pull?(controller: ReadableStreamDefaultController<R>): void | Promise<void>; | ||
cancel?(reason: string): void | Promise<void>; | ||
} | ||
export interface ReadableByteStreamSource { | ||
start?(controller: ReadableByteStreamController): void | Promise<void>; | ||
pull?(controller: ReadableByteStreamController): void | Promise<void>; | ||
export interface ReadableByteStreamSource<R = ArrayBufferView> { | ||
start?(controller: ReadableByteStreamController<R>): void | Promise<void>; | ||
pull?(controller: ReadableByteStreamController<R>): void | Promise<void>; | ||
cancel?(reason: string): void | Promise<void>; | ||
@@ -21,4 +23,4 @@ | ||
export interface QueuingStrategy { | ||
size?(chunk: ArrayBufferView): number; | ||
export interface QueuingStrategy<T = ArrayBufferView> { | ||
size?(chunk: T): number; | ||
highWaterMark?: number; | ||
@@ -33,18 +35,23 @@ } | ||
declare class ReadableStream { | ||
constructor(underlyingSource?: ReadableStreamSource, strategy?: QueuingStrategy); | ||
constructor(underlyingSource?: ReadableByteStreamSource, strategy?: QueuingStrategy); | ||
export interface WritableReadablePair<T extends WritableStream<any>, U extends ReadableStream<any>> { | ||
writable: T; | ||
readable: U; | ||
} | ||
declare class ReadableStream<R = ArrayBufferView> { | ||
constructor(underlyingSource?: ReadableStreamSource<R>, strategy?: QueuingStrategy<R>); | ||
constructor(underlyingSource?: ReadableByteStreamSource<R>, strategy?: QueuingStrategy<R>); | ||
locked: boolean; | ||
cancel(reason: string): Promise<void>; | ||
getReader(): ReadableStreamDefaultReader; | ||
getReader({ mode }: { mode: "byob" }): ReadableStreamBYOBReader; | ||
pipeThrough<T extends ReadableStream>({ writable, readable }: { writable: WritableStream, readable: T }, options?: PipeOptions): T; | ||
getReader(): ReadableStreamDefaultReader<R>; | ||
getReader({ mode }: { mode: "byob" }): ReadableStreamBYOBReader<R>; | ||
pipeThrough<T extends ReadableStream<any>>({ writable, readable }: WritableReadablePair<WritableStream<R>, T>, options?: PipeOptions): T; | ||
pipeTo(dest: WritableStream, options?: PipeOptions): Promise<void>; | ||
tee(): [ReadableStream, ReadableStream]; | ||
tee(): [ReadableStream<R>, ReadableStream<R>]; | ||
} | ||
declare class ReadableStreamDefaultReader { | ||
constructor(stream: ReadableStream); | ||
declare class ReadableStreamDefaultReader<R = ArrayBufferView> { | ||
constructor(stream: ReadableStream<R>); | ||
@@ -54,7 +61,7 @@ closed: Promise<void>; | ||
cancel(reason: string): Promise<void>; | ||
read(): Promise<IteratorResult<ArrayBufferView>>; | ||
read(): Promise<IteratorResult<R>>; | ||
releaseLock(): void; | ||
} | ||
declare class ReadableStreamBYOBReader { | ||
declare class ReadableStreamBYOBReader<R = ArrayBufferView> { | ||
constructor(stream: ReadableStream); | ||
@@ -65,8 +72,8 @@ | ||
cancel(reason: string): Promise<void>; | ||
read(view: ArrayBufferView): Promise<IteratorResult<ArrayBufferView>>; | ||
read(view: R): Promise<IteratorResult<R>>; | ||
releaseLock(): void; | ||
} | ||
declare class ReadableStreamDefaultController { | ||
constructor(stream: ReadableStream, underlyingSource: ReadableStreamSource, size: number, highWaterMark: number); | ||
declare class ReadableStreamDefaultController<R = ArrayBufferView> { | ||
constructor(stream: ReadableStream, underlyingSource: ReadableStreamSource<R>, size: number, highWaterMark: number); | ||
@@ -76,35 +83,35 @@ desiredSize: number; | ||
close(): void; | ||
enqueue(chunk: ArrayBufferView): number; | ||
enqueue(chunk: R): number; | ||
error(e: any): void; | ||
} | ||
declare class ReadableByteStreamController { | ||
constructor(stream: ReadableStream, underlyingSource: ReadableStreamSource, highWaterMark: number); | ||
declare class ReadableByteStreamController<R = ArrayBufferView> { | ||
constructor(stream: ReadableStream<R>, underlyingSource: ReadableStreamSource<R>, highWaterMark: number); | ||
byobRequest: ReadableStreamBYOBRequest; | ||
byobRequest: ReadableStreamBYOBRequest<R>; | ||
desiredSize: number; | ||
close(): void; | ||
enqueue(chunk: ArrayBufferView): number; | ||
enqueue(chunk: R): number; | ||
error(e: any): void; | ||
} | ||
declare class ReadableStreamBYOBRequest { | ||
constructor(controller: ReadableByteStreamController, view: ArrayBufferView); | ||
declare class ReadableStreamBYOBRequest<R = ArrayBufferView> { | ||
constructor(controller: ReadableByteStreamController<R>, view: R); | ||
view: ArrayBufferView; | ||
view: R; | ||
respond(bytesWritten: number): void; | ||
respondWithNewView(view: ArrayBufferView): void; | ||
respondWithNewView(view: R): void; | ||
} | ||
interface WritableStreamSink { | ||
start?(controller: WritableStreamDefaultController): void | Promise<void>; | ||
write?(chunk: any, controller?: WritableStreamDefaultController): any; | ||
close?(controller: WritableStreamDefaultController): void | Promise<void>; | ||
interface WritableStreamSink<W = ArrayBufferView> { | ||
start?(controller: WritableStreamDefaultController<W>): void | Promise<void>; | ||
write?(chunk: W, controller?: WritableStreamDefaultController<W>): any; | ||
close?(controller: WritableStreamDefaultController<W>): void | Promise<void>; | ||
abort?(reason: string): void | Promise<void>; | ||
} | ||
declare class WritableStream { | ||
constructor(underlyingSink?: WritableStreamSink, strategy?: QueuingStrategy); | ||
declare class WritableStream<W = ArrayBufferView> { | ||
constructor(underlyingSink?: WritableStreamSink<W>, strategy?: QueuingStrategy<W>); | ||
@@ -114,7 +121,7 @@ locked: boolean; | ||
abort(reason: string): Promise<void>; | ||
getWriter(): WritableStreamDefaultWriter; | ||
getWriter(): WritableStreamDefaultWriter<W>; | ||
} | ||
declare class WritableStreamDefaultWriter { | ||
constructor(stream: WritableStream); | ||
declare class WritableStreamDefaultWriter<W = ArrayBufferView> { | ||
constructor(stream: WritableStream<W>); | ||
@@ -128,7 +135,7 @@ closed: Promise<void>; | ||
releaseLock(): void; | ||
write(chunk: any): Promise<void>; | ||
write(chunk: W): Promise<void>; | ||
} | ||
declare class WritableStreamDefaultController { | ||
constructor(stream: WritableStream, underlyingSink: WritableStreamSink, size: number, highWaterMark: number); | ||
declare class WritableStreamDefaultController<W = ArrayBufferView> { | ||
constructor(stream: WritableStream<W>, underlyingSink: WritableStreamSink<W>, size: number, highWaterMark: number); | ||
@@ -138,6 +145,6 @@ error(e: any): void; | ||
declare class ByteLengthQueuingStrategy { | ||
declare class ByteLengthQueuingStrategy<T = ArrayBufferView> { | ||
constructor({ highWaterMark }: { highWaterMark: number }); | ||
size(chunk: ArrayBufferView): number | undefined; | ||
size(chunk: T): number | undefined; | ||
} | ||
@@ -150,1 +157,22 @@ | ||
} | ||
declare interface TransformStreamTransformer<R, W> { | ||
start?(controller: TransformStreamDefaultController<W>): void | Promise<void>; | ||
transform?(chunk: R, controller: TransformStreamDefaultController<W>): void | Promise<void>; | ||
flush?(controller: TransformStreamDefaultController<W>): void | Promise<void>; | ||
} | ||
declare class TransformStream<R, W> implements WritableReadablePair<WritableStream<W>, ReadableStream<R>> { | ||
constructor(transformer?: TransformStreamTransformer<R, W>, writableStrategy?: QueuingStrategy<W>, readableStrategy?: QueuingStrategy<R>); | ||
readonly readable: ReadableStream<R>; | ||
readonly writable: WritableStream<W>; | ||
} | ||
declare class TransformStreamDefaultController<W> { | ||
enqueue(chunk: W): void; | ||
error(reason: any): void; | ||
terminate(): void; | ||
readonly desiredSize: number; | ||
} |
{ | ||
"name": "@types/whatwg-streams", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "TypeScript definitions for Streams API", | ||
@@ -11,2 +11,7 @@ "license": "MIT", | ||
"githubUsername": "saschanaz" | ||
}, | ||
{ | ||
"name": "Konstantin Simon Maria Möllers", | ||
"url": "https://github.com/ksm2", | ||
"githubUsername": "ksm2" | ||
} | ||
@@ -21,4 +26,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "206ab407389160f7c6df1ccc48f5f1eab8a045af5015570992b0822d7936f6a2", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "27a181bd55f4160de4a1406978ff878218eafb390e6ca8030db4de269228ad5c", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Fri, 22 Sep 2017 17:57:46 GMT | ||
* Last updated: Wed, 25 Apr 2018 19:08:55 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Kagami Sascha Rosylight <https://github.com/saschanaz>. | ||
These definitions were written by Kagami Sascha Rosylight <https://github.com/saschanaz>, Konstantin Simon Maria Möllers <https://github.com/ksm2>. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8344
127