mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Correct return type for getContents
This commit is contained in:
Vendored
+1
-1
@@ -15,7 +15,7 @@ export class WritableStreamBuffer extends stream.Writable {
|
||||
constructor(options?: WritableStreamBufferOptions);
|
||||
size(): number;
|
||||
maxSize(): number;
|
||||
getContents(length?: number): any;
|
||||
getContents(length?: number): Buffer;
|
||||
getContentsAsString(encoding?: string, length?: number): string;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,16 +20,16 @@ myWritableStreamBuffer.size();
|
||||
myWritableStreamBuffer.maxSize();
|
||||
|
||||
// Gets all held data as a Buffer.
|
||||
myWritableStreamBuffer.getContents();
|
||||
const contents: Buffer = myWritableStreamBuffer.getContents();
|
||||
|
||||
// Gets all held data as a utf8 string.
|
||||
myWritableStreamBuffer.getContentsAsString('utf8');
|
||||
const stringContents: string = myWritableStreamBuffer.getContentsAsString('utf8');
|
||||
|
||||
// Gets first 5 bytes as a Buffer.
|
||||
myWritableStreamBuffer.getContents(5);
|
||||
const contents2: Buffer = myWritableStreamBuffer.getContents(5);
|
||||
|
||||
// Gets first 5 bytes as a utf8 string.
|
||||
myWritableStreamBuffer.getContentsAsString('utf8', 5);
|
||||
const stringContents2: string = myWritableStreamBuffer.getContentsAsString('utf8', 5);
|
||||
|
||||
const myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({
|
||||
frequency: 10, // in milliseconds.
|
||||
|
||||
Reference in New Issue
Block a user