Module jls.io.Pipe

Provides pipe and named pipe abstraction.

The Pipe class provides inter-process stream communication. The Pipe class also provides named pipe.

Note: Named pipes are only available with the luv module.

Class Pipe

Pipe:new () Creates a new Pipe.
pipe:bind (name[, backlog]) Binds this pipe to the specified name.
pipe:onAccept (pipeClient) Accepts a new pipe client.
pipe:connect (name[, callback]) Connects this pipe to the specified name.
pipe:open (f) Opens an existing file descriptor as this pipe.
pipe:readStart (stream) Starts reading data on this pipe.
pipe:readStop () Stops reading data on this pipe.
pipe:write (data[, callback]) Writes data on this pipe.
pipe:chmod (mode) Makes the pipe writable or readable by all users.
pipe:close ([callback]) Closes this pipe.


Class Pipe

The Pipe class.
Pipe:new ()
Creates a new Pipe.
pipe:bind (name[, backlog])
Binds this pipe to the specified name.

Parameters:

  • name string the name of the pipe.
  • backlog number the connection queue size, default is 32. (optional)

Returns:

    jls.lang.Promise a promise that resolves once the pipe server is bound.
pipe:onAccept (pipeClient)
Accepts a new pipe client. This method should be overriden, the default implementation closes the client.

Parameters:

  • pipeClient the pipe client to accept.
pipe:connect (name[, callback])
Connects this pipe to the specified name.

Parameters:

  • name string the name of the pipe.
  • callback function an optional callback function to use in place of promise. (optional)

Returns:

    jls.lang.Promise a promise that resolves once the pipe is connected.
pipe:open (f)
Opens an existing file descriptor as this pipe.

Parameters:

  • f number the file descriptor as an integer
pipe:readStart (stream)
Starts reading data on this pipe.

Parameters:

pipe:readStop ()
Stops reading data on this pipe.
pipe:write (data[, callback])
Writes data on this pipe.

Parameters:

  • data string the data to write.
  • callback function an optional callback function to use in place of promise. (optional)

Returns:

    jls.lang.Promise a promise that resolves once the data has been written.
pipe:chmod (mode)
Makes the pipe writable or readable by all users. Enables access to the pipe from other processes.

Parameters:

  • mode string the mode to set, could be 'r', 'w' or 'rw'
pipe:close ([callback])
Closes this pipe.

Parameters:

  • callback function an optional callback function to use in place of promise. (optional)

Returns:

    jls.lang.Promise a promise that resolves once the pipe is closed.
generated by LDoc 1.4.6