Stream Equal is a Node.js utility package designed to test if two readable streams emit the exact same data. The package is currently stable at version 2.0.1, with recent updates indicating active maintenance, including a fix for CommonJS imports. It operates by comparing streams chunk-by-chunk, pausing them as needed to keep them synchronized. This method is highlighted as being more efficient in terms of memory and CPU usage for large files compared to buffering entire stream contents or computing cryptographic hashes, especially when the streams are not equal. Its primary application is in testing scenarios where stream content verification is crucial, offering a performance-optimized alternative to traditional comparison methods.
npm install stream-equalVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use `streamEqual` with async/await to compare two readable streams, showing both equal and unequal cases.
Rewrite stream comparison logic to `await streamEqual(stream1, stream2)` instead of `streamEqual(stream1, stream2, callback)`.
Update to `stream-equal@2.0.1` or newer. If unable to update, try `const streamEqual = require('stream-equal').default;` as a workaround, though it's not the recommended long-term solution.Ensure you are on `stream-equal@2.0.1` or newer for robust CJS `require`. For ESM, use `import streamEqual from 'stream-equal';`. For older CJS versions, try `const streamEqual = require('stream-equal').default;`.Remove the callback function and use `await` with the `streamEqual` promise directly: `const result = await streamEqual(stream1, stream2);`.
No dependency data recorded yet.