Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
utils.async.map(res, function (config, next) {
if (dest) {
config.contents
.pipe(writeFile.stream(config.dest))
.on('error', next)
.on('finish', function () {
next(null, config);
});
} else {
config.contents
.pipe(writeBuffer(function (err, content) {
if (err) return next(err);
config.content = content;
next(null, config);
}))
.on('error', next);
}
}, function (err, results) {
if (err) return cb(err);
writeJson.stream = function(filepath, options) {
var args = [].slice.call(arguments, 1);
return writeFile.stream(filepath, stringify.apply(null, args));
};
utils.async.each(res, function (config, next) {
config.contents
.pipe(writeFile.stream(config.dest))
.on('error', next)
.on('finish', next);
}, function (err) {
if (err) return cb(err);