Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
await repo.blocks.delete(cid)
removedBlocksCount++
} catch (err) {
res.err = new Error(`Could not delete block with CID ${cid}: ${err.message}`)
}
return res
} catch (err) {
const msg = `Could not convert block with key '${k}' to CID`
log(msg, err)
return { err: new Error(msg + `: ${err.message}`) }
}
}
for await (const res of transform(BLOCK_RM_CONCURRENCY, removeBlock, blockKeys)) {
// filter nulls (blocks that were retained)
if (res) yield res
}
log(`Marked set has ${markedSet.size} unique blocks. Blockstore has ${blocksCount} blocks. ` +
`Deleted ${removedBlocksCount} blocks.`)
}