LogoPear Docs
ReferencesBareModules

bare-pipe

Reference for bare-pipe: native I/O pipes for Bare—duplex pipe streams over file descriptors and named pipes, with a server for accepting connections.

stable

bare-pipe provides native I/O pipes for Bare: duplex streams over file descriptors (such as standard I/O) and named pipes / Unix domain sockets, plus a server for accepting connections. Pipes are bare-stream duplex streams. It's a native addon and requires Bare >=1.16.0.

npm i bare-pipe

Usage

const Pipe = require('bare-pipe')

const stdout = new Pipe(1)
stdout.write('Hello world!\n')

API

Pipe

const pipe = new Pipe([path][, options])

Create a pipe. Pass a file descriptor or a named-pipe path.

pipe.open(fd[, options][, onconnect]) · pipe.connect(path[, options][, onconnect])

Open over an existing descriptor, or connect to a named pipe.

pipe.write(chunk[, encoding][, handle][, cb]) · pipe.accept(target)

Write data (optionally passing a handle), or accept a transferred handle. Properties: connecting, pending, readyState. Pipes emit connect and handle.

pipe.ref() · pipe.unref()

Manage the event-loop reference.

Server

const server = Pipe.createServer([options][, onconnection])

Create a pipe server: server.listen(path[, backlog[, options]][, onlistening]), server.address(), server.close([onclose]), server.ref() / server.unref(), and server.listening. Emits listening, connection, close, error.

Pipe.createConnection(path[, options][, onconnect]) · Pipe.pipe() · Pipe.constants

Connection shorthand, a connected pipe pair, and constants.

Builds on bare-events and bare-stream (see Bare modules).

See also

On this page