canirequire › CommonJS › end-of-stream
Is end-of-stream ESM-only? Can you require() it?
Call a callback when a readable/writable/duplex stream has completed or failed.
Last verified Sep 9, 2026 against end-of-stream@1.4.5. JSON
CommonJS CommonJS — require() works on every Node.js version
end-of-stream ships CommonJS only. require("end-of-stream") works everywhere. import "end-of-stream" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.
Does end-of-stream@1.4.5 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("end-of-stream") from a CommonJS file and import "end-of-stream" from an ES module.
| Runtime | require("end-of-stream") | import "end-of-stream" |
|---|---|---|
| Node.js 18 | ✓ works | ✓ works |
| Node.js 20 | ✓ works | ✓ works |
| Node.js 22 | ✓ works | ✓ works |
| Node.js 24 | ✓ works | ✓ works |
| Node.js 26 | ✓ works | ✓ works |
| Bun 1.4 | ✓ works | ✓ works |
How to import end-of-stream
ES modules (import)
import endOfStream from "end-of-stream";Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.
CommonJS (require)
const endOfStream = require("end-of-stream");Module format by version
Derived from the type, main and exports fields of every stable release on npm (16 versions; the newest 16 shown).
| Versions | Format | First published |
|---|---|---|
| 0.1.0 – 1.4.5 | CommonJS | Nov 26, 2013 |
Frequently asked
Is end-of-stream ESM-only?
end-of-stream@1.4.5 is a CommonJS package. end-of-stream ships CommonJS only. require("end-of-stream") works everywhere. import "end-of-stream" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.
Can I import end-of-stream with ES module syntax?
Yes. import endOfStream from "end-of-stream" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.
Does end-of-stream work in Bun?
Yes. import "end-of-stream" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does end-of-stream ship TypeScript types?
Not bundled. Install the community types with "npm install -D @types/end-of-stream".
Links
Other commonjs packages
- debug 4.4.3CommonJS
- semver 7.8.5CommonJS
- ms 2.1.3CommonJS
- picomatch 4.0.7CommonJS
- ajv 8.20.0CommonJS
- source-map 0.8.0CommonJS
- react-is 19.2.8CommonJS
- readable-stream 4.7.0CommonJS
Similar popularity
- data-view-buffer 1.0.2CommonJS
- data-view-byte-offset 1.0.1CommonJS
- cors 2.8.6CommonJS
- tar-stream 3.2.1CommonJS
- sharp 0.35.4Dual
- d3-interpolate 3.0.1ESM-only
- jest-diff 30.5.1Dual
- @tailwindcss/node 4.3.3Dual