Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Acts as a stream to send a buffer, gather a buffer, or both.
npm install --save buffed
Show:
pipe(buffer)
(to use as a source)// reused in examples below.
var buffer = getSomeBuffer()
// NOTE: everywhere you see `buffer` as an arg to
// methods, including the constructor,
// you could provide an array of buffers instead.
// Piping out: Buffed as a source
// 1a. create instance with buffer to pipe out
var buffed = require('buffed')(buffer)
// 1b. pipe buffer to another stream
buffed.pipe(anotherStream)
// 2a. get buffed function to use to create instances
var Buffed = require('buffed')
// 2b. create an instance with a buffer and pipe it to another stream
Buffed(buffer).pipe(anotherStream)
// or:
Buffed.pipe(buffer).pipe(anotherStream)
// Piping in: Buffed as a sink
// 3a. get buffed function to create an instance
var Buffed = require('buffed')
// 3b. create a source buffed
var sink = Buffed()
// combine 3a and 3b:
var sink = require('buffed')()
// 3c. use event to get full buffer from sink
sink.on('finish', function() {
console.log('collected buffers:',sink.buffers)
console.log('as single buffer:', sink.combine())
})
// 3d. pipe stream to buffed
anotherStream.pipe(sink)
// Both source and sink
// 4a. get instance from function (like 1a)
var buffed = require('buffed')(buffer)
// 4b. use event to get full buffer from it
buffed.on('finish', function() {
console.log('collected buffers:',sink.buffers)
console.log('as single buffer:', sink.combine())
})
// 4c. pipe to another stream and then back to itself
buffed.pipe(anotherStream).pipe(buffed)
// Separate instances for source and sink
// 5a. get function to create instances
var buffed = require('buffed')
// 5b. create a source
var source = buffed(buffer)
// 5c. create a sink
var sink = buffed()
// 5d. use event to get full buffer from sink
sink.on('finish', function() {
console.log('collected buffers:',sink.buffers)
console.log('as single buffer:', sink.combine())
})
// 5e. pipe source thru another stream to sink
source.pipe(anotherStream).pipe(sink)
// the Buffed class is also exported as a subproperty
// 6a. get class
var Buffed = require('buffed').Buffed
// 6b. create an instance as a source (has a buffer) (can be a sink, too)
var source = new Buffed(buffer)
// 6c. create an instance as a sink (no buffer)
var sink = new Buffed
// Reset buffed instance with new buffer
// 7a. create a buffed instance
var buffed = require('buffed')(buffer)
// 7b. use event to continue when it's done:
buffed.on('finish', function() {
console.log('collected buffers:',sink.buffers)
console.log('as single buffer:', sink.combine())
// 7d. reuse it to pipe something else via reset
buffed.reset(getNewBuffer()).pipe(differentStream).pipe(buffed)
// OR:
// 7e. call pipe with a buffer which does a reset and returns itself
buffed.pipe(getNewBuffer()).pipe(differentStream).pipe(buffed)
})
// 7c. use buffed
buffed.pipe(anotherStream).pipe(buffed)
// ES6 version:
import Buffed from 'buffed'
const source = new Buffed(buffer)
const sink = new Buffed()
source.pipe(anotherStream).pipe(sink)
sink.on('finish', () =>
console.log('collected buffers:',sink.buffers)
console.log('as single buffer:', sink.combine())
)
1.0.0 - Released 2019/01/04
FAQs
Acts as a stream to send a buffer, gather buffers, or both.
The npm package buffed receives a total of 9 weekly downloads. As such, buffed popularity was classified as not popular.
We found that buffed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.