Minor execution edjustment
This commit is contained in:
parent
59cc470e1e
commit
5c34244996
1 changed files with 3 additions and 6 deletions
9
index.js
9
index.js
|
@ -173,15 +173,12 @@ async function unpackDirectory(directory, options = {}) {
|
||||||
if(!/^\./.test(header.name)) {
|
if(!/^\./.test(header.name)) {
|
||||||
const writePath = path.join(directory, header.name);
|
const writePath = path.join(directory, header.name);
|
||||||
|
|
||||||
var fileWriteStream;
|
|
||||||
try {
|
try {
|
||||||
fileWriteStream = fs.createWriteStream(writePath);
|
|
||||||
} catch (e) {
|
|
||||||
// Assume directory may not exist if an error is thrown
|
|
||||||
fs.mkdirSync(path.dirname(writePath), { recursive: true });
|
fs.mkdirSync(path.dirname(writePath), { recursive: true });
|
||||||
fileWriteStream = fs.createWriteStream(writePath);
|
} catch (e) {
|
||||||
|
// Directory exists
|
||||||
}
|
}
|
||||||
|
const fileWriteStream = fs.createWriteStream(writePath);
|
||||||
fileWriteStream.write(contents);
|
fileWriteStream.write(contents);
|
||||||
fileWriteStream.end();
|
fileWriteStream.end();
|
||||||
next();
|
next();
|
||||||
|
|
Loading…
Add table
Reference in a new issue