Merge pull request #12609 from lukas-zech-software/types-2.0

Add 'bytesRead' and 'path' to fs.ReadStream
This commit is contained in:
Andy
2016-11-15 07:10:49 -08:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -2167,6 +2167,8 @@ declare module "fs" {
export interface ReadStream extends stream.Readable {
close(): void;
destroy(): void;
bytesRead: number;
path: string | Buffer;
/**
* events.EventEmitter
+8
View File
@@ -434,11 +434,19 @@ namespace util_tests {
// http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
function stream_readable_pipe_test() {
var rs = fs.createReadStream(Buffer.from('file.txt'));
var r = fs.createReadStream('file.txt');
var z = zlib.createGzip({ finishFlush: zlib.Z_FINISH });
var w = fs.createWriteStream('file.txt.gz');
assert(typeof r.bytesRead === 'number');
assert(typeof r.path === 'string');
assert(typeof rs.path === 'Buffer');
r.pipe(z).pipe(w);
r.close();
rs.close();
}
// Simplified constructors