Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

promisify extractSAPUI5 in downloader-core #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions packages/sapui5-downloader-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,30 @@ class Downloader {
async extractSAPUI5(zipFile, updateProgress) {
console.log(`Extracting SAPUI5 to ${this.directories.extract}`)

await fs.remove(this.directories.extract)
await fs.mkdirp(this.directories.extract)
return new Promise(async (resolve) => {
await fs.remove(this.directories.extract)
await fs.mkdirp(this.directories.extract)

const zip = new StreamZip({
file: zipFile,
storeEntries: true,
})
const zip = new StreamZip({
file: zipFile,
storeEntries: true,
})

zip.on('ready', () => {
zip
.on('extract', () => {
if (updateProgress) {
updateProgress(zip.entriesCount)
}
})
.extract(null, this.directories.extract, () => {
zip.close(() => {
console.log('SAPUI5 extracted')
zip.on('ready', () => {
zip
.on('extract', () => {
if (updateProgress) {
updateProgress(zip.entriesCount)
}
})
})
})
.extract(null, this.directories.extract, () => {
zip.close(() => {
console.log('SAPUI5 extracted')
resolve();
})
})
})
});
}
}

Expand Down