-
-
Notifications
You must be signed in to change notification settings - Fork 200
Closed
Description
What / Why
When you attempt to extract a tarball through streams sometimes it will be closed with an error: [ERR_STREAM_PREMATURE_CLOSE]: Premature close, although the files are successfully extracted. No Errors Codes are shown in the process.
It seems to happen only on newer versions of Node > v18
Looking at the spec it seems now that streams that emit a close event before a end event trigger this error, so worth taking a look on that.
When
- n/a
Where
- n/a
How
Current Behavior
- It throws an
ERR_STREAM_PREMATURE_CLOSEError when trying to extract
Steps to Reproduce
$ nvm install 18.7.0
$ npm install tar got
$ mkdir output
import stream from 'node:stream';
import { promisify } from 'util';
import tar from 'tar';
import got from 'got';
const pipeline = promisify(stream.pipeline);
pipeline(
got.stream('https://codeload.github.com/npm/node-tar/tar.gz/main'),
tar.extract({ cwd: './output' }, ['node-tar-main/lib'])
)Expected Behavior
- It should extract the content of the archive without any issues
References
- Related to Next.js Issue #39321
balazsorban44 and webark
Metadata
Metadata
Assignees
Labels
No labels