-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
exp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulhelp wantedSeeking public contribution on this issueSeeking public contribution on this issue
Description
@alanshaw had an API suggestion over @ storacha/ipfs-car#74
const out = await CarWriter.fromIterable([root], blockstore.blocks())Some things to be resolved:
- Should it be named
fromBlockIterable()to make absolutely clear that this is a{cid,bytes}iterator it wants, because every otherfromIterable()in the API currently is aUint8Arrayiterator? This API would be able to take as input aCarBlockIterator, so we have prior-art for that name. (fs.createWriteStream('out.car', CarWriter.fromIterable([], await CarBlockIterator.fromIterable(fs.createReadStream('in.car'))[transferring roots is possible but it would take more than one line!]). - Does it need an
awaitand if so what is it waiting on? Looking at the code, I thinkCarWriter.create()now is sync and doesn't need theawaiteven though I see I've used it on the README! I don't think there's any good reason why aCarWriter.fromIterable()couldn't returnoutstraight away, so maybe theawaitis entirely unnecessary here. The AsyncIterable protocol gives us everything we need to set up async constructions and should also allow proper error propagation regardless of where it happens in this chain.
Metadata
Metadata
Assignees
Labels
exp/intermediatePrior experience is likely helpfulPrior experience is likely helpfulhelp wantedSeeking public contribution on this issueSeeking public contribution on this issue