We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to decode a single file content to string using async iterators:
async function streamToString(stream) { // https://stackoverflow.com/a/63361543/166524 const chunks = []; for await (const chunk of stream) { chunks.push(Buffer.from(chunk)); } return Buffer.concat(chunks).toString("utf8"); } const stream = fs.createReadStream(proj) .pipe(unzipper.ParseOne(reFile)); const data = await streamToString(stream);
but it fails like this:
TypeError: stream is not async iterable
OTOH this works fine:
function streamToString(stream) { const chunks = []; return new Promise((resolve, reject) => { stream.on('data', chunk => chunks.push(chunk)); stream.on('error', err => reject(err)); stream.on('end', () => resolve(Buffer.concat(chunks).toString("utf8"))); }); }
I see that nodejs' Duplex itself had this bug two years ago, might this be related?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm trying to decode a single file content to string using async iterators:
but it fails like this:
OTOH this works fine:
I see that nodejs' Duplex itself had this bug two years ago, might this be related?
The text was updated successfully, but these errors were encountered: