Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function computeBlockMap(archiveFile: string, compressionMethod: "lzma", compressionLevel: 9 | 1): Promise {
const zip = await openZip(archiveFile)
try {
const entries = await zip.readEntries()
const files = await BluebirdPromise.map(entries, async entry => {
const blocks = await computeBlocks(zip.fd, entry.dataStart, entry.dataStart + entry.compressedSize)
return {
name: (entry.fileName as string).replace(/\\/g, "/"),
size: entry.compressedSize,
blocks,
}
}, {concurrency: 8})
return {
blockSize: 64,
hashMethod: "md5",
compressionMethod,
compressionLevel,
files,