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)) {
|
||||
const writePath = path.join(directory, header.name);
|
||||
|
||||
var fileWriteStream;
|
||||
try {
|
||||
fileWriteStream = fs.createWriteStream(writePath);
|
||||
} catch (e) {
|
||||
// Assume directory may not exist if an error is thrown
|
||||
fs.mkdirSync(path.dirname(writePath), { recursive: true });
|
||||
fileWriteStream = fs.createWriteStream(writePath);
|
||||
} catch (e) {
|
||||
// Directory exists
|
||||
}
|
||||
|
||||
const fileWriteStream = fs.createWriteStream(writePath);
|
||||
fileWriteStream.write(contents);
|
||||
fileWriteStream.end();
|
||||
next();
|
||||
|
|
Loading…
Reference in a new issue