diff options
author | Brian White <mscdex@mscdex.net> | 2013-07-01 05:44:03 -0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-01 13:08:09 +0200 |
commit | 086d4ccace1d28e410f9982155d6762676d14483 (patch) | |
tree | a1eb45dc1193db440da20b1f1fc4f5a444eef6c6 /lib/zlib.js | |
parent | 0004ffa5da1437c5c104ab64c170b158e596f22d (diff) | |
download | android-node-v8-086d4ccace1d28e410f9982155d6762676d14483.tar.gz android-node-v8-086d4ccace1d28e410f9982155d6762676d14483.tar.bz2 android-node-v8-086d4ccace1d28e410f9982155d6762676d14483.zip |
zlib: allow custom flush type for flush()
Diffstat (limited to 'lib/zlib.js')
-rw-r--r-- | lib/zlib.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/zlib.js b/lib/zlib.js index bbe09ef2c2..ef4edd6d7e 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -357,9 +357,14 @@ Zlib.prototype._flush = function(callback) { this._transform(new Buffer(0), '', callback); }; -Zlib.prototype.flush = function(callback) { +Zlib.prototype.flush = function(kind, callback) { var ws = this._writableState; + if (typeof kind === 'function' || (kind === undefined && !callback)) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } + if (ws.ended) { if (callback) process.nextTick(callback); @@ -372,7 +377,7 @@ Zlib.prototype.flush = function(callback) { self.flush(callback); }); } else { - this._flushFlag = binding.Z_FULL_FLUSH; + this._flushFlag = kind; this.write(new Buffer(0), '', callback); } }; |