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.

42 lines
664 B

4 years ago
  1. # is-stream [![Build Status](https://travis-ci.org/sindresorhus/is-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/is-stream)
  2. > Check if something is a [Node.js stream](https://nodejs.org/api/stream.html)
  3. ## Install
  4. ```
  5. $ npm install --save is-stream
  6. ```
  7. ## Usage
  8. ```js
  9. const fs = require('fs');
  10. const isStream = require('is-stream');
  11. isStream(fs.createReadStream('unicorn.png'));
  12. //=> true
  13. isStream({});
  14. //=> false
  15. ```
  16. ## API
  17. ### isStream(stream)
  18. #### isStream.writable(stream)
  19. #### isStream.readable(stream)
  20. #### isStream.duplex(stream)
  21. #### isStream.transform(stream)
  22. ## License
  23. MIT © [Sindre Sorhus](https://sindresorhus.com)