Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

README.md 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # merge-stream
  2. Merge (interleave) a bunch of streams.
  3. [![build status](https://secure.travis-ci.org/grncdr/merge-stream.svg?branch=master)](http://travis-ci.org/grncdr/merge-stream)
  4. ## Synopsis
  5. ```javascript
  6. var stream1 = new Stream();
  7. var stream2 = new Stream();
  8. var merged = mergeStream(stream1, stream2);
  9. var stream3 = new Stream();
  10. merged.add(stream3);
  11. merged.isEmpty();
  12. //=> false
  13. ```
  14. ## Description
  15. This is adapted from [event-stream](https://github.com/dominictarr/event-stream) separated into a new module, using Streams3.
  16. ## API
  17. ### `mergeStream`
  18. Type: `function`
  19. Merges an arbitrary number of streams. Returns a merged stream.
  20. #### `merged.add`
  21. A method to dynamically add more sources to the stream. The argument supplied to `add` can be either a source or an array of sources.
  22. #### `merged.isEmpty`
  23. A method that tells you if the merged stream is empty.
  24. When a stream is "empty" (aka. no sources were added), it could not be returned to a gulp task.
  25. So, we could do something like this:
  26. ```js
  27. stream = require('merge-stream')();
  28. // Something like a loop to add some streams to the merge stream
  29. // stream.add(streamA);
  30. // stream.add(streamB);
  31. return stream.isEmpty() ? null : stream;
  32. ```
  33. ## Gulp example
  34. An example use case for **merge-stream** is to combine parts of a task in a project's **gulpfile.js** like this:
  35. ```js
  36. const gulp = require('gulp');
  37. const htmlValidator = require('gulp-w3c-html-validator');
  38. const jsHint = require('gulp-jshint');
  39. const mergeStream = require('merge-stream');
  40. function lint() {
  41. return mergeStream(
  42. gulp.src('src/*.html')
  43. .pipe(htmlValidator())
  44. .pipe(htmlValidator.reporter()),
  45. gulp.src('src/*.js')
  46. .pipe(jsHint())
  47. .pipe(jsHint.reporter())
  48. );
  49. }
  50. gulp.task('lint', lint);
  51. ```
  52. ## License
  53. MIT