iso-random-stream provides an isomorphic (Node.js and browser compatible) readable stream for cryptographic random bytes. In Node.js environments, it leverages `crypto.randomBytes`, while in browsers, it utilizes `Crypto.getRandomValues()` for secure randomness. The package is currently at version 2.0.2, primarily releasing bug fixes and minor updates after a significant breaking change in version 2.0.0. The v2.0.0 release refactored the internal implementation, removed an explicit `Buffer` dependency, and introduced first-party TypeScript type definitions. Unlike some alternatives, it offers a streaming interface, which is beneficial for generating large quantities of random data without consuming excessive memory upfront.
npm install iso-random-streamVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to create a readable stream of 100 random bytes and pipe it to a writable stream for consumption.
Review how you handle stream chunks, especially if you had explicit `Buffer` checks or transformations. Update bundler configurations to remove any `buffer` polyfills that were previously required for this library.
Always use named imports: `import { randomStream } from 'iso-random-stream'` (ESM) or `const { randomStream } = require('iso-random-stream')` (CommonJS).Remove `@types/iso-random-stream` from your `devDependencies` in `package.json`.
Ensure you are destructuring the named export: `const { randomStream } = require('iso-random-stream');` for CommonJS or `import { randomStream } from 'iso-random-stream';` for ESM.Ensure `randomStream` is imported as a named export: `import { randomStream } from 'iso-random-stream';`.No dependency data recorded yet.