Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(decompress): cast input to buffer
decode expects a <JsBuffer> as input

close #38
  • Loading branch information
simonecorsi committed Nov 5, 2021
1 parent deb6c18 commit 9bdf8f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -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))
}

0 comments on commit 9bdf8f3

Please sign in to comment.