Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve) => {
const zip = new StreamZip({ file: book });
zip.on('error', (err) => { console.error(err); });
// this._zips[book] = zip;
resolve(zip);
});
}
const extract = () => {
let zip = new StreamZip({
file: zipPath,
storeEntries: true
})
zip.on('error', console.error)
zip.on('ready', () => {
zip.extract(null, config.drive.mountPoint, (err) => {
if (err) {
return console.error(err)
}
return extracted()
})
})
}
}, () => {
let zip = new StreamZip({
file: path.resolve(os.tmpdir(), zipName),
storeEntries: true
})
zip.on('error', console.error)
zip.on('ready', () => {
zip.extract(null, path.resolve(config.drive.mountPoint, 'files9'), (err) => {
if (err) {
return console.error(err)
}
return this.setFinished()
})
})
})
})
this.downloadFile('decrypt9.zip', url, false, (err) => {
if (err) {
return console.error('Error downloading decrypt9...', err)
}
let zip = new StreamZip({
file: path.resolve(os.tmpdir(), 'decrypt9.zip'),
storeEntries: true
})
zip.on('error', console.error)
const fileName = 'Decrypt9WIP.bin'
zip.on('ready', () => {
zip.extract(fileName, os.tmpdir(), (err) => {
if (err) {
return console.error(err)
}
fsextra.move(path.resolve(os.tmpdir(), fileName), path.resolve(config.drive.mountPoint, 'safehaxpayload.bin'), (err) => {
if (err) {
return console.error(err)
const openZip = new Promise((resolve, reject) => {
const zip = new StreamZip({ file: systemFile, storeEntries: true })
.once('ready', handleReady)
.once('error', handleError)
function handleReady() {
cleanup()
resolve(zip)
}
function handleError(error: Error) {
cleanup()
zip.close()
reject(error)
}
function cleanup() {
zip.removeListener('ready', handleReady)
await new Promise((resolve, reject) => {
const zip = new StreamZip({
file: 'artifacts.build.zip',
storeEntries: true
});
mkdirp(path.join(__dirname, 'build/'), (err) => {
if (err) {
reject(err);
} else {
zip.on('ready', () => {
zip.extract(null, path.join(__dirname, 'build/'), (err) => {
if (err) {
reject(err);
} else {
zip.close();
resolve();
}