duplexer3

WebJar for duplexer3

Лицензия

Лицензия

BSD 3-Clause
Группа

Группа

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

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

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

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

0.1.4
Дата

Дата

Тип

Тип

jar
Описание

Описание

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

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

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

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

https://github.com/floatdrop/duplexer3

Скачать duplexer3

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

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

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

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

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

duplexer3 Build Status Coverage Status

Like duplexer2 but using Streams3 without readable-stream dependency

var stream = require("stream");

var duplexer3 = require("duplexer3");

var writable = new stream.Writable({objectMode: true}),
    readable = new stream.Readable({objectMode: true});

writable._write = function _write(input, encoding, done) {
  if (readable.push(input)) {
    return done();
  } else {
    readable.once("drain", done);
  }
};

readable._read = function _read(n) {
  // no-op
};

// simulate the readable thing closing after a bit
writable.once("finish", function() {
  setTimeout(function() {
    readable.push(null);
  }, 500);
});

var duplex = duplexer3(writable, readable);

duplex.on("data", function(e) {
  console.log("got data", JSON.stringify(e));
});

duplex.on("finish", function() {
  console.log("got finish event");
});

duplex.on("end", function() {
  console.log("got end event");
});

duplex.write("oh, hi there", function() {
  console.log("finished writing");
});

duplex.end(function() {
  console.log("finished ending");
});
got data "oh, hi there"
finished writing
got finish event
finished ending
got end event

Overview

This is a reimplementation of duplexer using the Streams3 API which is standard in Node as of v4. Everything largely works the same.

Installation

Available via npm:

$ npm i duplexer3

API

duplexer3

Creates a new DuplexWrapper object, which is the actual class that implements most of the fun stuff. All that fun stuff is hidden. DON'T LOOK.

duplexer3([options], writable, readable)
const duplex = duplexer3(new stream.Writable(), new stream.Readable());

Arguments

  • options - an object specifying the regular stream.Duplex options, as well as the properties described below.
  • writable - a writable stream
  • readable - a readable stream

Options

  • bubbleErrors - a boolean value that specifies whether to bubble errors from the underlying readable/writable streams. Default is true.

License

3-clause BSD. A copy is included with the source.

Contact

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

Версия
0.1.4