From c26c29ca034209ddf46dd2392a54ee29b6818ccf Mon Sep 17 00:00:00 2001 From: Dan Butvinik Date: Mon, 15 Oct 2018 18:20:51 -0700 Subject: [PATCH] expose options to pass through to yauzl --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3c1f943..a900d74 100644 --- a/index.js +++ b/index.js @@ -73,7 +73,7 @@ const extractFile = zip => new Promise((resolve, reject) => { zip.on('end', () => resolve(files)); }); -module.exports = () => buf => { +module.exports = opts => buf => { if (!Buffer.isBuffer(buf)) { return Promise.reject(new TypeError(`Expected a Buffer, got ${typeof buf}`)); } @@ -82,5 +82,7 @@ module.exports = () => buf => { return Promise.resolve([]); } - return pify(yauzl.fromBuffer)(buf, {lazyEntries: true}).then(extractFile); + opts = Object.assign({lazyEntries: true}, opts || {}); + + return pify(yauzl.fromBuffer)(buf, opts).then(extractFile); };