using readable stream no matter what node version

This commit is contained in:
Thorsten Lorenz 2014-04-02 20:08:52 -04:00
parent 810b82ff2c
commit 0069fbeb47
2 changed files with 7 additions and 8 deletions

View file

@ -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() {};

10
pack.js
View file

@ -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;
module.exports = Pack;