@function createWriteStream

@param {string} path
@param {object} options

@returns {Promise}
489289
function createWriteStream (path, options) {
    // build meta data
    var metadata = {}
    // get content type for file
    var contentType = mimeTypes.lookup(path)
    // set content type if found
    if (contentType) {
        metadata.contentType = contentType
    }
    // make sure bucket exists
    return this.bucketExists().then(() => {
        // create file write stream
        return this.bucket.file(path).createWriteStream({
            gzip: this.defaultGzip,
            metadata: metadata,
            public: this.defaultPublic,
            resumable: false,
        })
    })
}
548905
function write(destPath, options) {
  var debug = require('../debug').spawn('write');

  debug(function() { return 'destPath'; });
  debug(function() { return destPath; });

  debug(function() { return 'original options';});
  debug(function() { return options; });

  if (options === undefined && typeof destPath !== 'string') {
    options = destPath;
    destPath = undefined;
  }
  options = options || {};

  // set defaults for options if unset
  if (options.includeContent === undefined) {
    options.includeContent = true;
  }
  if (options.addComment === undefined) {
    options.addComment = true;
  }
  if (options.charset === undefined) {
    options.charset = 'utf8';
  }

  debug(function() { return 'derrived options'; });
  debug(function() { return options; });

  var internals = internalsInit(destPath, options);

  function sourceMapWrite(file, encoding, callback) {
    if (file.isNull() || !file.sourceMap) {
      this.push(file);
      return callback();
    }

    if (file.isStream()) {
      return callback(new Error(utils.PLUGIN_NAME + '-write: Streaming not supported'));
    }

    // fix paths if Windows style paths
    file.sourceMap.file = unixStylePath(file.relative);

    internals.setSourceRoot(file);
    internals.loadContent(file);
    internals.mapSources(file);
    internals.mapDestPath(file, this);

    this.push(file);
    callback();
  }

  return through.obj(sourceMapWrite);
}
90709
function writeStreamToFs(opts, stream) {
    var baseDir = path.join(opts.cwd, opts.directory);
    var walker = walk.walk(baseDir);

    walker.on('errors', function (root, stats, next) {
        stream.emit('error', new PluginError(PLUGIN_NAME, stats.error));
        next();
    });
    walker.on('directory', function (root, stats, next) {
        next();
    });

    walker.on('file', function (root, stats, next) {
        var filePath = path.resolve(root, stats.name);

        fs.readFile(filePath, function (error, data) {
            if (error) {
                stream.emit('error', new PluginError(PLUGIN_NAME, error));
            } else {
                stream.write(new Vinyl({
                    path: path.relative(baseDir, filePath),
                    contents: data
                }));
            }

            next();
        });
    });

    walker.on('end', function () {
        stream.emit('end');
        stream.emit('finish');
    });
}
781927
function createStream() {
  var firstChunk = true;

  var stream = through(function transform(chunk, encoding, next) {
    if (!firstChunk) return next(null, chunk);

    firstChunk = false;

    var regex = /^(.+?)(\(function\(\)\{)/
      , pattern;

    chunk = chunk.toString().replace(regex, function replacer(match, p1, p2) {
      pattern = p1;
      return p2;
    });

    this.push(prune(pattern) + chunk);
    next();
  });

  stream.label = 'prune-umd';
  return stream;
}
63329
function write(filepath, contents) {
  return new Promise((resolve, reject)=>{
    fs.writeFile(filepath, contents, (err, response)=>{
      if (err) return reject(err);
      return resolve(response);
    })
  });
}
20455
function writeAssetTxt(clientLibPath, asset, options) {

  if (!asset || !asset.type || !_.isArray(asset.files)) {
    return;
  }
  var outputFile = path.join(clientLibPath, asset.type + ".txt");
  var basePath = path.posix.join(clientLibPath, asset.base);

  // determines file path relative to the base
  var filenames = [];
  var typeExt = "." + asset.type;

  options.verbose && console.log("write clientlib asset txt file (type: " + asset.type + "): " + outputFile);

  asset.files.forEach(function (file) {

    // inject only files that correspondents to the asset type
    if (path.extname(file.dest) === typeExt) {
      var rel = path.posix.relative(basePath, file.dest);
      filenames.push(rel);
    }
  });

  var content = "#base=" + asset.base + "\n\n" + filenames.join("\n");
  content.trim();

  if (!options.dry) {
    fs.writeFileSync(outputFile, content);
  }
}
349931
function(key, path, next) {
    this.fileSystem.get(key, function(err, data) {
      fs.writeFile(path, data, function(err) {
        if (err) {
          console.log(err);
        }
        next(err, data); 
      });
    });
  }
385157
function(config) {
        var self = this;

        return new Promise(function(resolve, reject) {
            if (self._options.output) {
                fs.writeFileAsync(self._options.output, config)
                    .then(function() {
                        resolve(config);
                    });
            } else {
                resolve(config);
            }
        });
    }
384363
function writeStreamToFile(fileMeta, stream) {
  var deferred = q.defer();
  stream.on('end', function() {
    deferred.resolve(fileMeta);
  });
  stream.on('error', function(error) {
    deferred.reject(error);
  });
  var filename = imageDir + '/' + fileMeta.uid;
  stream.pipe(fs.createWriteStream(filename));
  return deferred.promise;
}
428744
function writeFileSync (filename, content, options) {
  if (typeof filename !== 'string') {
    throw new Error('path must be a string')
  }

  mkdirp.sync(path.dirname(filename))
  fs.writeFileSync(filename, content, options)
}
1209595
function writeFileAsync (filename, content, options, cb) {
  if (typeof filename !== 'string') {
    throw new Error('path must be a string')
  }

  if (typeof options === 'function') {
    cb = options
  }

  mkdirp(path.dirname(filename), function (err) {
    if (err && typeof cb === 'function') {
      return cb(err)
    }

    fs.writeFile(filename, content, options, cb)
  })
}
586344
function writeStream(filename, st) {
    var d = Promise.defer();

    var wstream = fs.createWriteStream(filename);
    var cleanup = function() {
        destroy(wstream);
        wstream.removeAllListeners();
    };

    wstream.on('finish', function () {
        cleanup();
        d.resolve();
    });
    wstream.on('error', function (err) {
        cleanup();
        d.reject(err);
    });

    st.on('error', function(err) {
        cleanup();
        d.reject(err);
    });

    st.pipe(wstream);

    return d.promise;
}
1070739
function(content, options) {
    var options = options || {},
        content = content || '',
        file = generator.build(options);
    
    try {
      fs.writeFileSync(file, content, options);
      return file;
    }
    catch(e) { throw e; }
  }
1060858
async function createDirectory(sftp, path) {
  return new Promise((resolve, reject) => {
    sftp.mkdir(path, error => (error ? reject(error) : resolve()));
  });
}
800155
function writeFile(namespace, fileName, fileLocation) {
  if (!gfsPromise) {
    return;
  }
  return gfsPromise.then(function(gfs) {
    var deferred = q.defer();
    var options = {
      filename: fileName
    };
    if (namespace) {
      options.root = namespace;
    }
    var writeStream = gfs.createWriteStream(options);
    writeStream.on('error', function(err) {
      console.log('An error occurred!', err);
      deferred.reject(err);
    });
    writeStream.on('close', function(file) {
      deferred.resolve(file);
    });
    fs.createReadStream(fileLocation).pipe(writeStream);
    return deferred.promise;
  });
}
1113586
function (path) {
        return new Promise((resolve, reject) => {
            fs.access(path, fs.constants.F_OK, (err) => {
                if (err === null) {
                    resolve(true);
                }
                else if (err.code === 'ENOENT') {
                    resolve(false);
                }
                else {
                    reject(err);
                }
            });
        });
    }
955400
function createWritable() {
    var $args = arguments;return new Promise(function ($return, $error) {
        var file, ws;
        file = $args.length > 0 && $args[0] !== undefined ? $args[0] : getTempFile();
        return Promise.resolve(openFileForWrite(file)).then(function ($await_2) {
            try {
                ws = $await_2;
                return $return(ws);
            } catch ($boundEx) {
                return $error($boundEx);
            }
        }.bind(this), $error);
    }.bind(this));
}