lib/write.js
async function writeStream (filename, contents) {
  await new Promise((resolve, reject) => {
    contents.pipe(fs.createWriteStream(filename))
      .on('finish', function () {
        resolve(filename)
      })
      .on('error', /* istanbul ignore next */ function (err) {
        reject(err)
      })
  })
  return filename
}
async function writeStream (filename, contents) {
  await new Promise((resolve, reject) => {
    contents.pipe(fs.createWriteStream(filename))
      .on('finish', function () {
        resolve(filename)
      })
      .on('error', /* istanbul ignore next */ function (err) {
        reject(err)
      })
  })
  return filename
}
async function writeStream ( filename , contents ) { await new Promise ( ( resolve , reject ) => { contents . pipe ( fs . createWriteStream ( filename ) ) . on ( 'finish' , function ( ) { resolve ( filename ) } ) . on ( 'error' , /* istanbul ignore next */ function ( err ) { reject ( err ) } ) } ) return filename }
Write a Readable to a file and
@param {string} filename
@param {stream.Readable} contents
@private
@returns {Promise<string>} a promise for the filename
Write a Readable to a file and