multistream

WebJar for multistream

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

multistream
Последняя версия

Последняя версия

2.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

multistream
WebJar for multistream
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/feross/multistream

Скачать multistream

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/multistream/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>multistream</artifactId>
    <version>2.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/multistream/
implementation 'org.webjars.npm:multistream:2.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/multistream/
implementation ("org.webjars.npm:multistream:2.1.1")
'org.webjars.npm:multistream:jar:2.1.1'
<dependency org="org.webjars.npm" name="multistream" rev="2.1.1">
  <artifact name="multistream" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='multistream', version='2.1.1')
)
libraryDependencies += "org.webjars.npm" % "multistream" % "2.1.1"
[org.webjars.npm/multistream "2.1.1"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.webjars.npm : inherits jar [2.0.1,3)
org.webjars.npm : readable-stream jar [2.0.5,3)

Модули Проекта

Данный проект не имеет модулей.

multistream travis npm downloads javascript style guide

A stream that emits multiple other streams one after another (streams3)

Sauce Test Status

cat

Simple, robust streams3 version of combined-stream. Allows you to combine multiple streams into a single stream. When the first stream ends, the next one starts, and so on, until all streams are consumed.

This module is used by WebTorrent, specifically create-torrent.

install

npm install multistream

usage

Use multistream like this:

var MultiStream = require('multistream')
var fs = require('fs')

var streams = [
  fs.createReadStream(__dirname + '/numbers/1.txt'),
  fs.createReadStream(__dirname + '/numbers/2.txt'),
  fs.createReadStream(__dirname + '/numbers/3.txt')
]

new MultiStream(streams).pipe(process.stdout) // => 123

You can also create an object-mode stream with MultiStream.obj(streams).

To lazily create the streams, wrap them in a function:

var streams = [
  fs.createReadStream(__dirname + '/numbers/1.txt'),
  function () { // will be executed when the stream is active
    return fs.createReadStream(__dirname + '/numbers/2.txt')
  },
  function () { // same
    return fs.createReadStream(__dirname + '/numbers/3.txt')
  }
]

new MultiStream(streams).pipe(process.stdout) // => 123

Alternatively, streams may be created by an asynchronous "factory" function:

var count = 0
function factory (cb) {
  if (count > 3) return cb(null, null)
  count++
  setTimeout(function () {
    cb(null, fs.createReadStream(__dirname + '/numbers/' + count + '.txt'))
  }, 100)
}

new MultiStream(factory).pipe(process.stdout) // => 123

contributors

license

MIT. Copyright (c) Feross Aboukhadijeh.

Версии библиотеки

Версия
2.1.1