Write to a Node.js stream using the error-first callback style.
Write to a Node.js stream using the error-first callback style. Staccato is part of the Cadence Universe. With it you can feed a stream using error-first callbacks, a write to the stream will block if the stream is paused or if there is too much back-pressure, so you can generate a stream from a Cadence loop and the loop will pause when the stream is full.
var Staccato = require'staccato'var out = fscreateWriteStream'./out.txt'var writer = cadencevar written = 0var loop = asynccryptorandomBytes1024 asyncwritten += byteslengthoutwritebytes asyncif written >= bytesreturn loopbreakwriter if error throw error