Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
putMany (nodes, format, userOptions) {
if (!typical.isIterable(nodes) || typeof nodes === 'string' ||
Buffer.isBuffer(nodes)) {
throw new Error('`nodes` must be an iterable')
}
if (format === undefined) {
throw new Error('`put` requires a format')
}
if (typeof format !== 'number') {
throw new Error('`format` parameter must be number (multicodec)')
}
let options
let formatImpl
const generator = async function * () {
for await (const node of nodes) {
// Lazy load the options not when the iterator is initialized, but
removeMany (cids) {
if (!typical.isIterable(cids) || typeof cids === 'string' ||
Buffer.isBuffer(cids)) {
throw new Error('`cids` must be an iterable of CIDs')
}
const generator = async function * () {
for await (const cid of cids) {
yield this.remove(cid)
}
}.bind(this)
return extendIterator(generator())
}
getMany (cids) {
if (!typical.isIterable(cids) || typeof cids === 'string' ||
Buffer.isBuffer(cids)) {
throw new Error('`cids` must be an iterable of CIDs')
}
const generator = async function * () {
for await (const cid of cids) {
yield this.get(cid)
}
}.bind(this)
return extendIterator(generator())
}