|
|
@ -115,6 +115,10 @@ exports.deflate = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new Deflate(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.deflateSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new Deflate(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.gzip = function(buffer, opts, callback) { |
|
|
|
if (util.isFunction(opts)) { |
|
|
|
callback = opts; |
|
|
@ -123,6 +127,10 @@ exports.gzip = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new Gzip(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.gzipSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new Gzip(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.deflateRaw = function(buffer, opts, callback) { |
|
|
|
if (util.isFunction(opts)) { |
|
|
|
callback = opts; |
|
|
@ -131,6 +139,10 @@ exports.deflateRaw = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new DeflateRaw(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.deflateRawSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new DeflateRaw(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.unzip = function(buffer, opts, callback) { |
|
|
|
if (util.isFunction(opts)) { |
|
|
|
callback = opts; |
|
|
@ -139,6 +151,10 @@ exports.unzip = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new Unzip(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.unzipSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new Unzip(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.inflate = function(buffer, opts, callback) { |
|
|
|
if (util.isFunction(opts)) { |
|
|
|
callback = opts; |
|
|
@ -147,6 +163,10 @@ exports.inflate = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new Inflate(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.inflateSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new Inflate(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.gunzip = function(buffer, opts, callback) { |
|
|
|
if (util.isFunction(opts)) { |
|
|
|
callback = opts; |
|
|
@ -155,6 +175,10 @@ exports.gunzip = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new Gunzip(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.gunzipSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new Gunzip(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.inflateRaw = function(buffer, opts, callback) { |
|
|
|
if (util.isFunction(opts)) { |
|
|
|
callback = opts; |
|
|
@ -163,11 +187,11 @@ exports.inflateRaw = function(buffer, opts, callback) { |
|
|
|
return zlibBuffer(new InflateRaw(opts), buffer, callback); |
|
|
|
}; |
|
|
|
|
|
|
|
function zlibBuffer(engine, buffer, callback) { |
|
|
|
if (!util.isFunction(callback)) { |
|
|
|
return zlibBufferSync(engine, buffer, callback); |
|
|
|
} |
|
|
|
exports.inflateRawSync = function(buffer, opts) { |
|
|
|
return zlibBufferSync(new InflateRaw(opts), buffer); |
|
|
|
}; |
|
|
|
|
|
|
|
function zlibBuffer(engine, buffer, callback) { |
|
|
|
var buffers = []; |
|
|
|
var nread = 0; |
|
|
|
|
|
|
@ -200,7 +224,7 @@ function zlibBuffer(engine, buffer, callback) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function zlibBufferSync(engine, buffer, callback) { |
|
|
|
function zlibBufferSync(engine, buffer) { |
|
|
|
if (util.isString(buffer)) |
|
|
|
buffer = new Buffer(buffer); |
|
|
|
if (!util.isBuffer(buffer)) |
|
|
|