Skip to content

Conversation

talentlessguy
Copy link
Contributor

@talentlessguy talentlessguy commented Aug 4, 2025

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)

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Replaced external stream piping utilities with native Node.js stream API across codebase and tests.
    • Updated documentation examples to use native Node.js stream and directory creation methods.
    • Replaced external directory creation utilities with native Node.js directory creation methods using recursive options.
    • Removed obsolete dependencies and raised minimum Node.js version requirement to 18.0.0.
    • Updated CI workflows to test only Node.js versions 18 and above.

Copy link

coderabbitai bot commented Aug 4, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This change replaces usage of the external pump module with Node.js's native stream.pipeline method (aliased as pump) throughout the codebase, documentation, and tests. The mkdirp module is replaced by native fs.mkdir and fs.mkdirSync methods with { recursive: true } options for directory creation. The pump and mkdirp dependencies are removed from package.json, and the minimum Node.js version required is increased to 18.0.0. No logic or control flow is altered.

Changes

Cohort / File(s) Change Summary
Documentation Update
README.md
Updated example to use stream.pipeline (aliased as pump) instead of the external pump module; replaced mkdirp with fs.mkdir for directory creation.
Dependency & Engine Update
package.json
Removed pump and mkdirp from dependencies, reordered dependencies, raised Node.js minimum version to 18.0.0.
Library Code
lib/tgz/file_stream.js, lib/utils.js
Replaced external pump import with Node.js's stream.pipeline aliased as pump; replaced mkdirp with native fs.mkdir for recursive directory creation.
Test Utilities
test/util.js
Removed fallback using external pump; directly use stream.promises.pipeline; changed export style.
Gzip Tests
test/gzip/file_stream.test.js, test/gzip/uncompress_stream.test.js
Changed to use native pipeline as pump for stream operations.
Tar Tests
test/tar/file_stream.test.js, test/tar/stream.test.js, test/tar/uncompress_stream.test.js, test/tar/index.test.js
Updated to use stream.pipeline as pump in all relevant test files; replaced mkdirp with native fs.mkdir or fs.promises.mkdir for directory creation.
Tgz Tests
test/tgz/file_stream.test.js, test/tgz/stream.test.js, test/tgz/uncompress_stream.test.js, test/tgz/index.test.js
Replaced external pump with native pipeline aliased as pump in all test files; replaced mkdirp with native fs.mkdir or fs.promises.mkdir.
Zip Tests
test/zip/file_stream.test.js, test/zip/stream.test.js, test/zip/uncompress_stream.test.js, test/zip/index.test.js
Switched to using stream.pipeline as pump for all zip-related tests; replaced mkdirp with native fs.mkdirSync for recursive directory creation.
CI Workflow Update
.github/workflows/nodejs.yml
Updated Node.js versions tested to 18, 20, 22, and 24; removed older versions 14 and 16 from test matrix.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A hop, a skip, the pump is gone,
Native streams now carry on.
No more modules to install,
Node's own pipeline does it all!
Directories grow with native care,
This bunny’s code is light as air.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d119b6d and 5fb1834.

📒 Files selected for processing (1)
  • .github/workflows/nodejs.yml (1 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 to 10.0.0 in package.json.
  • pump Dependency Removal: The external pump 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-in stream.pipeline function, aliased as pump 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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 use util.promisify for better readability and conciseness.

Overall, this is a great step forward for the library.

Copy link

@coderabbitai coderabbitai bot left a 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 of stream.Transform.

test/zip/file_stream.test.js (1)

7-7: Optional: rename alias to improve clarity

Now 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-proof safePipe 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.
With stream.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 clarity

Now that we’re no longer using the pump package, keeping the alias pump 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 tests

Most 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 flows

Inside the tests you mix callback-style pump(...) with async/await (pipelinePromise). Now that Node provides stream/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 tests

Repeated 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 reduction

Same 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: Duplicate require('stream') call—consolidate to a single import
stream is already required on Line 1. Re-requiring it just to alias pipeline is redundant and marginally increases startup cost. Reuse the existing stream variable instead.

-const { pipeline: pump } = require('stream');
+const { pipeline: pump } = stream;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9478897 and 0e8b7e5.

📒 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 native stream.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 native stream.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-in stream.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 as pump 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 version

Same 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 API

Using 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-in stream.pipeline correctly replaces pump

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 good

The change eliminates the external module without altering behaviour.

test/tar/stream.test.js (1)

8-8: Correct replacement of pump with stream.pipeline

No functional or stylistic issues spotted in this segment.

test/zip/uncompress_stream.test.js (1)

8-8: stream.pipeline import ok

The aliasing approach is consistent with the rest of the suite.

@fengmk2
Copy link
Member

fengmk2 commented Aug 5, 2025

let us up to Node.js 18 and release a major version for the breaking change.

@talentlessguy
Copy link
Contributor Author

Awesome, I will remove stream.pipeline promise version polyfill as well then

@talentlessguy talentlessguy changed the title feat: remove pump and raise minimum node to v10 feat: remove pump and raise minimum node to v18 Aug 5, 2025
@talentlessguy
Copy link
Contributor Author

Removed mkdirp as well, since Node.js 10 it's not needed anymore

@fengmk2
Copy link
Member

fengmk2 commented Aug 9, 2025

I will fix the fails tests before publish a major version.

@fengmk2 fengmk2 merged commit 8ac1164 into node-modules:master Aug 9, 2025
2 of 3 checks passed
@fengmk2
Copy link
Member

fengmk2 commented Aug 9, 2025

I will fix the fails tests before publish a major version.

#114

fengmk2 pushed a commit that referenced this pull request Aug 9, 2025
[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 -->
Copy link

github-actions bot commented Aug 9, 2025

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@talentlessguy talentlessguy deleted the remove-pump branch August 10, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants