mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
fix(extension): fix unpack extension
This commit is contained in:
+10
-6
@@ -89,13 +89,17 @@ export async function install (id: string, url: string) {
|
||||
|
||||
extract.on('entry', (header, stream, next) => {
|
||||
const filePath = path.join(extensionPath, header.name.replace(/^package/, ''))
|
||||
console.log('[extension] write file', filePath)
|
||||
console.log('[extension] write', header.type, filePath)
|
||||
|
||||
fs.ensureFile(filePath).then(() => {
|
||||
const fileStream = fs.createWriteStream(filePath)
|
||||
stream.pipe(fileStream)
|
||||
stream.on('end', next)
|
||||
}).catch(reject)
|
||||
if (header.type === 'file') {
|
||||
fs.ensureFile(filePath).then(() => {
|
||||
const fileStream = fs.createWriteStream(filePath)
|
||||
stream.pipe(fileStream)
|
||||
stream.on('end', next)
|
||||
}).catch(reject)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
extract.on('finish', () => {
|
||||
|
||||
Reference in New Issue
Block a user