A simple pipe for buffers




A simple pipe for buffers. Write data to one end and read data off the other end.
npm install buffer-pipe``javascript
const pipe = require('buffer-pipe')
const p = new Pipe()
p.write(Buffer.from([1,2,3,4]))
const buf = p.read(2)
// <1, 2>
`
Creates a new instance of a pipe
Parameters
- buf Buffer an optional buffer to start with (optional, default Buffer.from([]))
read num number of bytes from the pipe
Parameters
- num Number
Returns Buffer
Wites a buffer to the pipe
Parameters
- buf` Buffer
Whether or not there is more data to read from the buffer
returns {Boolean}
returns the number of bytes read from the stream
Returns Integer
returns the number of bytes wrote to the stream
Returns Integer
[LICENSE]: https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)