1.0.0 • Published 4 years ago

end-of-stream-ts v1.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

end-of-stream-ts

Await the completion or error of a stream with typescript definitions

npm i -s end-of-stream-ts
# or
yarn add end-of-stream-ts
import endOfStream from 'end-of-stream';
import {createReadStream} from 'fs';

;(async () => {

    const stream = createReadStream(__filename);
    stream.on('data', d => console.log(d.toString()));

    try {
      await endOfStream(stream);
      console.log('done');
    } catch(e) {
      console.error(e);
    }

})();

Package based on end-of-stream.