Two questions about "extracting as an async iterator"
https://github.com/mafintosh/tar-stream?tab=readme-ov-file#extracting-as-an-async-iterator
The extraction stream in addition to being a writable stream is also an async iterator
-
Is it an AsyncIterable or an AsyncIterator?
-
How are the bodies of the entries consumed?
Is the following correct? (I think this works for me.)
for await (const entry of extract) {
if (entry.header.type === "file") {
for await (const chunk of entry) {
process(chunk);
}
} else {
entry.resume();
}
}
Two questions about "extracting as an async iterator"
https://github.com/mafintosh/tar-stream?tab=readme-ov-file#extracting-as-an-async-iterator
Is it an AsyncIterable or an AsyncIterator?
How are the bodies of the entries consumed?
Is the following correct? (I think this works for me.)