Node's file stream APIs for the web
npm install @cubbit/web-file-streamNode's file stream APIs for the web.
``ts
import {WebFileStream} from '@cubbit/web-file-stream';
const file = new File(['My test file'], 'test-file.txt', {
type: 'text/plain'
});
const read_stream = WebFileStream.create_read_stream(file);
read_stream.on('error', console.error);
read_stream.on('data', (data) => console.log(data));
read_stream.on('end', () => console.log('File read!'));
`
This is a module available through the npm registry.
Installation is done using the npm install command:
`bash`
npm install @cubbit/web-file-stream
* Automatic backpressuring
* Compatibility with File object API
* Same API as Node.js Stream objects
To run the test suite, first install the dependencies, then run npm test:
`bash``
npm install
npm test