From 0069fbeb47836fdb594fd48daf5550cb4ff1dd35 Mon Sep 17 00:00:00 2001 From: Thorsten Lorenz Date: Wed, 2 Apr 2014 20:08:52 -0400 Subject: [PATCH] using readable stream no matter what node version --- extract.js | 5 ++--- pack.js | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/extract.js b/extract.js index 60b3351..635e755 100644 --- a/extract.js +++ b/extract.js @@ -1,10 +1,9 @@ -var stream = require('stream'); var util = require('util'); var bl = require('bl'); var headers = require('./headers'); -var Writable = stream.Writable || require('readable-stream').Writable; -var PassThrough = stream.PassThrough || require('readable-stream').PassThrough; +var Writable = require('readable-stream').Writable; +var PassThrough = require('readable-stream').PassThrough; var noop = function() {}; diff --git a/pack.js b/pack.js index d43fd9d..60a5752 100644 --- a/pack.js +++ b/pack.js @@ -1,10 +1,10 @@ -var stream = require('stream'); var util = require('util'); var eos = require('end-of-stream'); var headers = require('./headers'); -var Readable = stream.Readable || require('readable-stream').Readable; -var Writable = stream.Writable || require('readable-stream').Writable; +var Readable = require('readable-stream').Readable; +var Writable = require('readable-stream').Writable; +var PassThrough = require('readable-stream').PassThrough; var END_OF_TAR = new Buffer(1024); END_OF_TAR.fill(0); @@ -86,7 +86,7 @@ Pack.prototype.entry = function(header, buffer, callback) { } this._encode(header); - this._stream = stream; + this._stream = new PassThrough(); var sink = new Sink(this); @@ -174,4 +174,4 @@ Pack.prototype._read = function(n) { drain(); }; -module.exports = Pack; \ No newline at end of file +module.exports = Pack;