Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async init({
lazyEntries = true,
autoClose = false,
decodeStrings = false
} = {}) {
const { cosInstance, Bucket, Region, Key, maxTryTime } = this
const reader = new CosRandomAccessReader({ cosInstance, Bucket, Region, Key, maxTryTime })
const totalSize = await reader.getTotalSize()
try {
this.zipFile = await yauzl.fromRandomAccessReaderRetryPromise(reader, totalSize, {
lazyEntries,
autoClose,
decodeStrings
})
appendFunction({
target: this.zipFile,
keys: ['openReadStream'],
maxTryTime: 1
})
} catch (error) {
throw {
error,
trace: 'UnzipFile.init.yauzl.fromRandomAccessReaderRetryPromise'
}
}
}