Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

  1. # end-of-stream
  2. A node module that calls a callback when a readable/writable/duplex stream has completed or failed.
  3. npm install end-of-stream
  4. ## Usage
  5. Simply pass a stream and a callback to the `eos`.
  6. Both legacy streams, streams2 and stream3 are supported.
  7. ``` js
  8. var eos = require('end-of-stream');
  9. eos(readableStream, function(err) {
  10. // this will be set to the stream instance
  11. if (err) return console.log('stream had an error or closed early');
  12. console.log('stream has ended', this === readableStream);
  13. });
  14. eos(writableStream, function(err) {
  15. if (err) return console.log('stream had an error or closed early');
  16. console.log('stream has finished', this === writableStream);
  17. });
  18. eos(duplexStream, function(err) {
  19. if (err) return console.log('stream had an error or closed early');
  20. console.log('stream has ended and finished', this === duplexStream);
  21. });
  22. eos(duplexStream, {readable:false}, function(err) {
  23. if (err) return console.log('stream had an error or closed early');
  24. console.log('stream has finished but might still be readable');
  25. });
  26. eos(duplexStream, {writable:false}, function(err) {
  27. if (err) return console.log('stream had an error or closed early');
  28. console.log('stream has ended but might still be writable');
  29. });
  30. eos(readableStream, {error:false}, function(err) {
  31. // do not treat emit('error', err) as a end-of-stream
  32. });
  33. ```
  34. ## License
  35. MIT
  36. ## Related
  37. `end-of-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.