pipefd
v1.0.0
Published
Create a pipe as a pair of file descriptors; does not use any addons
Downloads
3
Readme
This program creates a pipe; see the pipe(2) man page for details.
Internally it calls the external "mkfifo" command and then deletes the
file it created once it has opened it.
It exports a function, which takes one optional argument (a callback
function). It returns a promise, which will be resolved with an array
with two elements (the fd of the read end and write end). If the callback
function is specified, the returned promise is irrelevant.
The callback function takes three arguments: an error, the fd of the read
end, and the fd of the write end.
Note that although the pipe cannot be created synchronously (fs.openSync
on a named pipe blocks if the other end isn't already open), you can use
synchronous I/O with the created pipe. It is expected one end will be
passed to a child process.
This program is public domain.