Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const CombinedStream = require('combined-stream2');
function concatStringsAndStreams(strings, ...args) {
let combinedStream = CombinedStream.create()
combinedStream.append(Buffer.from(strings[0], 'utf8'))
for (let i = 0; i < args.length; i++) {
let arg = args[i]
let string = strings[i+1]
if (arg && arg.pipe) {
combinedStream.append(arg)
}
else {
combinedStream.append(Buffer.from(String(arg), 'utf8'))
}
combinedStream.append(Buffer.from(String(string), 'utf8'))
}
return combinedStream
}
module.exports = concatStringsAndStreams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.