Yet another concat-stream, but cleans its internal state after use
npm install secure-concatsecure-concat
> Yet another concat-stream, but cleans its internal state after use
``js
var concat = require('secure-concat')
var ch1 = Buffer.from('hello')
var ch2 = Buffer.from(' ')
var ch3 = Buffer.from('world')
var s = concat({limit: 11}, function (err, slab) {
assert(slab.toString(), 'hello world')
assert(ch1.equals(Buffer.from([0, 0, 0, 0, 0])))
assert(ch2.equals(Buffer.from([0])))
assert(ch3.equals(Buffer.from([0, 0, 0, 0, 0])))
})
s.write(ch1)
s.write(ch2)
s.end(ch3)
`
Takes optional opts and cb(err, buf), and returns a WritableStream.opts.limit
You can limit how many bytes the stream will accept before causing an error with, which defaults to Infinity. You can disable cleaning of internalopts.cleanup
state with , which defaults to true. Cleanup consists of .fill(0)Buffer
of the received s in case of an error, and after the Buffers have beenconcated together.
`sh``
npm install secure-concat