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 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # merge2
  2. Merge multiple streams into one stream in sequence or parallel.
  3. [![NPM version][npm-image]][npm-url]
  4. [![Build Status][travis-image]][travis-url]
  5. [![Downloads][downloads-image]][downloads-url]
  6. ## Install
  7. Install with [npm](https://npmjs.org/package/merge2)
  8. ```sh
  9. npm install merge2
  10. ```
  11. ## Usage
  12. ```js
  13. const gulp = require('gulp')
  14. const merge2 = require('merge2')
  15. const concat = require('gulp-concat')
  16. const minifyHtml = require('gulp-minify-html')
  17. const ngtemplate = require('gulp-ngtemplate')
  18. gulp.task('app-js', function () {
  19. return merge2(
  20. gulp.src('static/src/tpl/*.html')
  21. .pipe(minifyHtml({empty: true}))
  22. .pipe(ngtemplate({
  23. module: 'genTemplates',
  24. standalone: true
  25. })
  26. ), gulp.src([
  27. 'static/src/js/app.js',
  28. 'static/src/js/locale_zh-cn.js',
  29. 'static/src/js/router.js',
  30. 'static/src/js/tools.js',
  31. 'static/src/js/services.js',
  32. 'static/src/js/filters.js',
  33. 'static/src/js/directives.js',
  34. 'static/src/js/controllers.js'
  35. ])
  36. )
  37. .pipe(concat('app.js'))
  38. .pipe(gulp.dest('static/dist/js/'))
  39. })
  40. ```
  41. ```js
  42. const stream = merge2([stream1, stream2], stream3, {end: false})
  43. //...
  44. stream.add(stream4, stream5)
  45. //..
  46. stream.end()
  47. ```
  48. ```js
  49. // equal to merge2([stream1, stream2], stream3)
  50. const stream = merge2()
  51. stream.add([stream1, stream2])
  52. stream.add(stream3)
  53. ```
  54. ```js
  55. // merge order:
  56. // 1. merge `stream1`;
  57. // 2. merge `stream2` and `stream3` in parallel after `stream1` merged;
  58. // 3. merge 'stream4' after `stream2` and `stream3` merged;
  59. const stream = merge2(stream1, [stream2, stream3], stream4)
  60. // merge order:
  61. // 1. merge `stream5` and `stream6` in parallel after `stream4` merged;
  62. // 2. merge 'stream7' after `stream5` and `stream6` merged;
  63. stream.add([stream5, stream6], stream7)
  64. ```
  65. ```js
  66. // nest merge
  67. // equal to merge2(stream1, stream2, stream6, stream3, [stream4, stream5]);
  68. const streamA = merge2(stream1, stream2)
  69. const streamB = merge2(stream3, [stream4, stream5])
  70. const stream = merge2(streamA, streamB)
  71. streamA.add(stream6)
  72. ```
  73. ## API
  74. ```js
  75. const merge2 = require('merge2')
  76. ```
  77. ### merge2()
  78. ### merge2(options)
  79. ### merge2(stream1, stream2, ..., streamN)
  80. ### merge2(stream1, stream2, ..., streamN, options)
  81. ### merge2(stream1, [stream2, stream3, ...], streamN, options)
  82. return a duplex stream (mergedStream). streams in array will be merged in parallel.
  83. ### mergedStream.add(stream)
  84. ### mergedStream.add(stream1, [stream2, stream3, ...], ...)
  85. return the mergedStream.
  86. ### mergedStream.on('queueDrain', function() {})
  87. It will emit 'queueDrain' when all streams merged. If you set `end === false` in options, this event give you a notice that should add more streams to merge or end the mergedStream.
  88. #### stream
  89. *option*
  90. Type: `Readable` or `Duplex` or `Transform` stream.
  91. #### options
  92. *option*
  93. Type: `Object`.
  94. * **end** - `Boolean` - if `end === false` then mergedStream will not be auto ended, you should end by yourself. **Default:** `undefined`
  95. * **pipeError** - `Boolean` - if `pipeError === true` then mergedStream will emit `error` event from source streams. **Default:** `undefined`
  96. * **objectMode** - `Boolean` . **Default:** `true`
  97. `objectMode` and other options(`highWaterMark`, `defaultEncoding` ...) is same as Node.js `Stream`.
  98. ## License
  99. MIT © [Teambition](https://www.teambition.com)
  100. [npm-url]: https://npmjs.org/package/merge2
  101. [npm-image]: http://img.shields.io/npm/v/merge2.svg
  102. [travis-url]: https://travis-ci.org/teambition/merge2
  103. [travis-image]: http://img.shields.io/travis/teambition/merge2.svg
  104. [downloads-url]: https://npmjs.org/package/merge2
  105. [downloads-image]: http://img.shields.io/npm/dm/merge2.svg?style=flat-square