From f5199daabf90879dfeb6fed42159f4fe94628ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=97=B6=E5=A9=A7?= Date: Thu, 4 Apr 2019 14:21:45 +0800 Subject: [PATCH] return uncompress dir structure --- lib/utils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index a7c4e91..9dff94f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -85,6 +85,7 @@ exports.makeUncompressFn = StreamClass => { } return new Promise((resolve, reject) => { + const list = []; mkdirp(destDir, err => { if (err) return reject(err); @@ -93,7 +94,7 @@ exports.makeUncompressFn = StreamClass => { let isFinish = false; function done() { // resolve when both stream finish and file write finish - if (isFinish && entryCount === successCount) resolve(); + if (isFinish && entryCount === successCount) resolve(list); } new StreamClass(opts) @@ -103,6 +104,7 @@ exports.makeUncompressFn = StreamClass => { }) .on('error', reject) .on('entry', (header, stream, next) => { + list.push(header.name); stream.on('end', next); if (header.type === 'file') {