Correct return type for getContents

This commit is contained in:
maghis
2017-03-30 12:21:33 -04:00
parent f23f93a55e
commit d405d11df4
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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;
}
+4 -4
View File
@@ -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.