end-of-stream-ts

TS/Promise wrapper over end-of-stream module

Usage no npm install needed!

<script type="module">
  import endOfStreamTs from 'https://cdn.skypack.dev/end-of-stream-ts';
</script>

README

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.