From 9bdf8f39d4a6792798a3641b6a5b4d2d5dfe6b45 Mon Sep 17 00:00:00 2001 From: Simone Corsi Date: Thu, 4 Nov 2021 23:56:34 +0100 Subject: [PATCH] fix(decompress): cast input to buffer decode expects a as input close #38 --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 1f30da2..7774a03 100644 --- a/index.js +++ b/index.js @@ -20,9 +20,9 @@ module.exports.compress = function compress(input) { } module.exports.uncompress = function uncompress(input, opt = { asBuffer: true }) { - return _uncompress(input, Boolean(opt.asBuffer)) + return _uncompress(Buffer.isBuffer(input) ? input : Buffer.from(input), Boolean(opt.asBuffer)) } module.exports.uncompressSync = function uncompressSync(input, opt = { asBuffer: true }) { - return _uncompressSync(input, Boolean(opt.asBuffer)) + return _uncompressSync(Buffer.isBuffer(input) ? input : Buffer.from(input), Boolean(opt.asBuffer)) }