-
Notifications
You must be signed in to change notification settings - Fork 34
feat: remove pump
and raise minimum node to v18
#113
New issue
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
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis change replaces usage of the external Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant NodeStream
participant FileSystem
User->>App: Initiate stream operation (compress, decompress)
App->>NodeStream: Call pipeline (aliased as pump)
NodeStream-->>App: Manage stream piping and errors
App->>FileSystem: Create directories using fs.mkdir/fs.mkdirSync with recursive option
FileSystem-->>App: Directory creation success or error
App-->>User: Operation complete or error reported
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @talentlessguy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request modernizes the project's Node.js compatibility by raising the minimum required version to 10.0.0. This upgrade enables the removal of the external pump
dependency, replacing its functionality with the native stream.pipeline
API, which offers similar robust stream error handling and cleanup capabilities.
Highlights
- Node.js Version Upgrade: The minimum required Node.js version for this project has been raised from
4.0.0
to10.0.0
inpackage.json
. pump
Dependency Removal: The externalpump
package has been removed from the project's dependencies, reducing the number of third-party modules.- Native Stream Pipeline Adoption: All instances where the
pump
utility was used for piping streams have been updated to leverage Node.js's built-instream.pipeline
function, aliased aspump
for consistent naming.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully removes the pump
dependency, replacing it with the native stream.pipeline
available since Node.js v10, and updates the minimum required Node.js version accordingly. The changes are consistent across the project.
I've provided a couple of suggestions for improvement:
- In
package.json
, I've suggested sorting the dependencies alphabetically for better maintainability. - In
test/util.js
, I've recommended clarifying a comment and refactoring the promise-based pipeline polyfill to useutil.promisify
for better readability and conciseness.
Overall, this is a great step forward for the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (9)
lib/tgz/file_stream.js (1)
6-7
: Consider consolidating stream imports.The import changes are functionally correct, but you have two separate imports from the
stream
module. Consider combining them for better maintainability:-const stream = require('stream'); -const { pipeline: pump } = require('stream'); +const stream = require('stream'); +const { pipeline: pump } = stream;Or alternatively:
-const stream = require('stream'); -const { pipeline: pump } = require('stream'); +const { Transform, pipeline: pump } = require('stream');Then update line 10 to use
Transform
instead ofstream.Transform
.test/zip/file_stream.test.js (1)
7-7
: Optional: rename alias to improve clarityNow that the external
pump
package is gone, consider keeping the native name for readability:-const { pipeline: pump } = require('stream'); +const { pipeline } = require('stream');(All invocations would then use
pipeline(...)
.)Purely cosmetic – feel free to ignore if you prefer to avoid sweeping renames.
lib/utils.js (1)
6-6
: Future-proofsafePipe
by spreading the streams array
safePipe
currently forwards only the first two items:pump(streams[0], streams[1], cb);If a call site ever hands in more than two streams, they will silently be ignored.
Withstream.pipeline
you can safely spread the array:- pump(streams[0], streams[1], err => { + pump(...streams, err => {Keeps behaviour identical for existing two-stream usages while removing the hidden foot-gun.
test/gzip/file_stream.test.js (1)
15-17
: Optional: rename the alias for clarityNow that we’re no longer using the
pump
package, keeping the aliaspump
can be slightly misleading to new contributors.
Consider switching to the canonical name to make the intent obvious:-const { pipeline: pump } = require('stream'); +const { pipeline } = require('stream'); ... - pump(sourceStream, gzipStream, destStream, err => { + pipeline(sourceStream, gzipStream, destStream, err => {test/tgz/stream.test.js (1)
24-26
: Minor: drop console noise in automated testsMost
console.log
calls were kept untouched. They’re helpful during development but add noise to CI output.
Feel free to remove or gate them behind a debug flag.Also applies to: 41-43, 57-59, 73-75, 89-91, 105-107, 120-122, 138-140, 157-159, 185-187
test/tar/uncompress_stream.test.js (1)
26-34
: Consider promisified pipeline for async flowsInside the tests you mix callback-style
pump(...)
withasync/await
(pipelinePromise
). Now that Node providesstream/promises
, you could simplify with:const { pipeline } = require('stream/promises'); await pipeline(src, dest);This would remove the need for
pipelinePromise
helpers and make tests a little cleaner.Also applies to: 57-65, 88-98, 122-130
test/tar/stream.test.js (1)
21-31
: Trim verbose logging in testsRepeated
console.log
statements can clutter CI logs and slow down runs.
Consider removing or wrapping them with a debug flag.Also applies to: 36-46, 52-62, 68-78, 84-94, 100-110, 116-124, 130-140, 148-160, 168-188
test/zip/uncompress_stream.test.js (1)
25-33
: Noise reductionSame comment as other suites: the many
console.log
calls add little value once the tests are stable.Also applies to: 56-65, 88-98, 122-131, 185-193, 215-223
test/util.js (1)
2-2
: Duplicaterequire('stream')
call—consolidate to a single import
stream
is already required on Line 1. Re-requiring it just to aliaspipeline
is redundant and marginally increases startup cost. Reuse the existingstream
variable instead.-const { pipeline: pump } = require('stream'); +const { pipeline: pump } = stream;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
README.md
(1 hunks)lib/tgz/file_stream.js
(1 hunks)lib/utils.js
(1 hunks)package.json
(2 hunks)test/gzip/file_stream.test.js
(1 hunks)test/gzip/uncompress_stream.test.js
(1 hunks)test/tar/file_stream.test.js
(1 hunks)test/tar/stream.test.js
(1 hunks)test/tar/uncompress_stream.test.js
(1 hunks)test/tgz/file_stream.test.js
(1 hunks)test/tgz/stream.test.js
(1 hunks)test/tgz/uncompress_stream.test.js
(1 hunks)test/util.js
(1 hunks)test/zip/file_stream.test.js
(1 hunks)test/zip/stream.test.js
(1 hunks)test/zip/uncompress_stream.test.js
(1 hunks)
🔇 Additional comments (11)
package.json (1)
64-64
: Node.js version requirement correctly updated.The minimum Node.js version is appropriately raised to 10.0.0, which is necessary since
stream.pipeline
was introduced in Node.js 10.0.0. Note that this is a breaking change for users on Node.js versions 4-9.README.md (1)
78-78
: Documentation correctly updated to use native stream.pipeline.The import statement properly demonstrates the migration from the external
pump
module to Node.js's nativestream.pipeline
method while maintaining the same usage pattern.test/tgz/file_stream.test.js (1)
7-7
: Test correctly updated to use native stream.pipeline.The import statement properly migrates from the external
pump
module to Node.js's nativestream.pipeline
method while maintaining test compatibility.test/tar/file_stream.test.js (1)
9-9
: Test import correctly migrated to native stream.pipeline.The import statement properly transitions from the external
pump
dependency to Node.js's built-instream.pipeline
method, maintaining test functionality and API compatibility.test/zip/stream.test.js (1)
8-8
: Confirm Node ≥ 10 runtime for test execution
stream.pipeline
is only available from Node 10+.
If CI or downstream consumers still run the test-suite on earlier Node versions, all tests that alias it aspump
will crash at require-time.No code change needed, but please verify the engines field / CI matrix was updated accordingly.
test/tgz/uncompress_stream.test.js (1)
8-8
: Engines field / docs should match raised minimum Node versionSame note as in other test files: ensure
package.json
now contains"engines": { "node": ">=10" }and that README badges / CI matrices align, otherwise users may install the new release under an unsupported Node and get a runtime error at the very first
require
.test/gzip/file_stream.test.js (1)
5-5
: Good swap to the built-in APIUsing
const { pipeline: pump } = require('stream');
cleanly removes the external dependency and works from Node 10 upward.
No further issues detected around this change.test/tgz/stream.test.js (1)
8-8
: Built-instream.pipeline
correctly replacespump
The import aligns with the new minimum Node version; everything else in the test continues to work as expected.
test/tar/uncompress_stream.test.js (1)
8-8
: Native pipeline import looks goodThe change eliminates the external module without altering behaviour.
test/tar/stream.test.js (1)
8-8
: Correct replacement ofpump
withstream.pipeline
No functional or stylistic issues spotted in this segment.
test/zip/uncompress_stream.test.js (1)
8-8
:stream.pipeline
import okThe aliasing approach is consistent with the rest of the suite.
let us up to Node.js 18 and release a major version for the breaking change. |
Awesome, I will remove |
pump
and raise minimum node to v10pump
and raise minimum node to v18
Removed |
I will fix the fails tests before publish a major version. |
|
[skip ci] ## 2.0.0 (2025-08-09) * fix: impl _final method instead hack pipe event (#114) ([ba52b7b](ba52b7b)), closes [#114](#114) * feat: remove `pump` and raise minimum node to v18 (#113) ([8ac1164](8ac1164)), closes [#113](#113) ### BREAKING CHANGE * Drop Node.js < 18 support Node.js 4 is long EOL, so this PR raises it to 18 as per comment. Node 10 has built-in `stream.pipeline` and `fs.mkdir` with `recursive` option, which can be used instead of `pump` (they are the same). Also 3 tests fail for me but they fail on main branch as well (timeout) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Replaced the external stream piping utility with the native Node.js stream API throughout the codebase and tests. * Updated documentation examples to reflect the new usage of the native stream API. * Replaced external directory creation utilities with native Node.js directory creation methods using recursive options. * Removed obsolete dependencies and increased the minimum required Node.js version to 18.0.0. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
BREAKING CHANGE: Drop Node.js < 18 support
Node.js 4 is long EOL, so this PR raises it to 18 as per comment. Node 10 has built-in
stream.pipeline
andfs.mkdir
withrecursive
option, which can be used instead ofpump
(they are the same).Also 3 tests fail for me but they fail on main branch as well (timeout)
Summary by CodeRabbit
Summary by CodeRabbit