# Is readable-stream ESM-only? Can you require() it?

> readable-stream@4.7.0 is a CommonJS package. CommonJS — require() works on every Node.js version we test.

Node.js Streams, a user-land copy of the stream library from Node.js

Last verified Sep 9, 2026 against readable-stream@4.7.0.

readable-stream ships CommonJS only. require("readable-stream") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^12.22.0 || ^14.17.0 || >=16.0.0. import "readable-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.

## What to do

1. require("readable-stream") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^12.22.0 || ^14.17.0 || >=16.0.0.
2. From ES modules use the default import: import readableStream from "readable-stream"; then destructure. Named imports only work when Node.js can statically detect the exports.
3. TypeScript: npm install -D @types/readable-stream

## Facts

- Latest: 4.7.0 (Jan 7, 2025)
- Module format: CommonJS
- Last CommonJS version: 4.7.0
- TypeScript types: @types/readable-stream
- Node engines: ^12.22.0 || ^14.17.0 || >=16.0.0
- Weekly downloads: 311.7M
- License: MIT

## Runtime test results for readable-stream@4.7.0

Installed and executed on Sep 9, 2026 with require("readable-stream") from a CommonJS file and import "readable-stream" from an ES module.

| Runtime | require("readable-stream") | import "readable-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.0 | works | works |

## How to import readable-stream

ES modules:

```js
import readableStream from "readable-stream";
```

CommonJS:

```js
const readableStream = require("readable-stream");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (90 versions; the newest 60 shown).

| Versions | Format | First published |
|---|---|---|
| 2.0.2 – 4.7.0 | CommonJS | Jul 16, 2015 |

## Frequently asked

**Is readable-stream ESM-only?**

readable-stream@4.7.0 is a CommonJS package. readable-stream ships CommonJS only. require("readable-stream") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^12.22.0 || ^14.17.0 || >=16.0.0. import "readable-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 readable-stream with ES module syntax?**

Yes. import readableStream from "readable-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 readable-stream work in Bun?**

Yes. import "readable-stream" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does readable-stream ship TypeScript types?**

Not bundled. Install the community types with "npm install -D @types/readable-stream".

## Links

- [readable-stream on npm](https://www.npmjs.com/package/readable-stream)
- [Source repository](https://github.com/nodejs/readable-stream)
- [HTML version](https://canirequire.com/package/readable-stream/)
- [JSON version](https://canirequire.com/package/readable-stream.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
