Packaging actions of receiver__._write
@param  {} __newFile
@param  {} encoding
@param  {} done
180302
function onFile(__newFile, encoding, done) {
  var buffers = [];
  var options = this.options;

  // Check the file limit
  if (options.perMaxBytes && __newFile.byteCount > options.perMaxBytes) {
    return done(new Error('The file \'' + __newFile.filename + '\' beyond size limit, only accept less than ' + options.perMaxBytes + ' bytes'));
  }

  // Check the accept content type
  if (options.acceptTypes && options.acceptTypes.indexOf(__newFile.headers['content-type']) === -1) {
    return done(new Error('Content-type of the file \'' + __newFile.filename + '\' does not accepted'));
  }

  // Determine the file descriptor-- the unique identifier.
  // Often represents the location where file should be written.
  __newFile.fd;
  var uploadDir = __newFile.fd;
  if (uploadDir.substr(0, 1) !== '/') {
    uploadDir = '/' + uploadDir;
  }

  // When then 'data' event emited, push the chunk to the buffers array.
  __newFile.on('data', function (chunk) {
    buffers.push(chunk);
  });

  // When the 'end' event emited, upload the 'buffers' to the upyun server.
  __newFile.on('end', function () {
    var buffer = Buffer.concat(buffers);
    uploadToUpyun.bind({ options })(uploadDir, buffer, __newFile, done);
  });
}
727244
function write(file, text='', encoding='utf-8') {
	if (file && file.file) {
		let pathFile = file.path ? file.path + '/' + file.file : file.file;
		return write(pathFile, file.text, file.encoding)
	}else{
		mkdir(file);
		fs.writeFileSync(file, text, encoding);
	}
}
375221
function makeFromFile(makefile,target){
	var read;
	var basedir='.';
	if(makefile){
		read = fs.createReadStream(makefile, {encoding: 'utf8'});
		basedir=mpath.dirname(makefile);
	}else{
		process.stdin.resume();
		process.stdin.setEncoding('utf8');
		read = process.stdin;
	}
	read.on('data', function (data){
		try {
			var o=JSON.parse(data);
			make(basedir, o, target);
		}catch(e){
			console.log(e);
		}
	});
}
711368
function(content) {
		if (typeof content != 'string') {
			content = JSON.stringify(content, null, '\t');
		}

		fs.writeFileSync(catalogFile, content);
	}
991536
@Override
   public void writeImport(Definition def, Writer out) throws IOException
   {
      out.write("package " + def.getRaPackage() + ";\n\n");
   }
437237
function (data) {

            if (!isLog()) {
                return undefined;
            }

            try {
                _fs.appendFileSync("pkgscript.log", (_utils.now() + "  " + data + "\n"), "utf8");

            } catch (e) {
                console.error(_utils.now + " [package-script] Package Script, ERROR:", e);
            }
        }
546807
function writeFile(filename, data) {
    return new Promise(function (fulfill, reject) {
        fs.writeFile(filename, data, function (err, res) {
            return err ? reject(err) : fulfill(res);
        });
    });
}
592613
public void append(Encoder encoder, EncodingState encodingState, CharSequence str, int off, int len)
            throws IOException {
        if (str == null || len <= 0) {
            return;
        }
        if (shouldEncode(encoder, encodingState)) {
            EncodingState newEncoders = createNewEncodingState(encoder, encodingState);
            if (encoder instanceof StreamingEncoder) {
                ((StreamingEncoder)encoder).encodeToStream(encoder, str, off, len, this, newEncoders);
            }
            else {
                CharSequence source;
                if (CharSequences.canUseOriginalForSubSequence(str, off, len)) {
                    source = str;
                }
                else {
                    source = str.subSequence(off, off + len);
                }
                encodeAndWrite(encoder, newEncoders, source);
            }
        }
        else {
            appendCharSequence(encodingState, str, off, off + len);
        }
    }
512375
function writeToLogFile(rawPacket, parsedPacket) {
  if (!debugMode) { return; }

  var now = new Date().toUTCString();

  fs.appendFile(config.debugRawDataFile, 'Package received at ' + now + ':\n' + rawPacket + '\n\n', function (err) {
    if (err) {
      console.error('Could not write raw package to ' + config.debugRawDataFile);
    }
  });

  fs.appendFile(config.debugParsedDataFile, 'Package received at ' + now + ':\n' + JSON.stringify(parsedPacket, true, 4) + '\n\n', function (err) {
    if (err) {
      console.error('Could not write parsed package to ' + config.debugParsedDataFile);
    }
  });
}
63329
function write(filepath, contents) {
  return new Promise((resolve, reject)=>{
    fs.writeFile(filepath, contents, (err, response)=>{
      if (err) return reject(err);
      return resolve(response);
    })
  });
}
1088558
function concatenateAndWriteFile(files, destination, separator) {
			if (!destination || !files || !files.length) return;

			files = _.map(files, process);

			var src = files.join(separator || grunt.util.linefeed);
			grunt.file.write(destination, src);
			grunt.log.writeln('File ' + destination.cyan + ' created.');
		}
971647
function write(file, cb) {
  if(file === undefined) file = this._file;

  if(file === DEFAULT_FILE) {
    return this.emit(
      'error', new Error('cannot write to default configuration'));
  }

  var sync = typeof cb !== 'function'
    , stream
    , save
    , encoder = new Encoder(this.options)
    , lines = this._lines
    , size = 32
    , i = 0
    , len = (lines.length / size);


  if(!file || typeof file !== 'string' && !(file instanceof Writable)){
    return this.emit('error',
      new Error('cannot write configuration, path or stream expected'));
  }

  if(typeof file === 'string') {
    file = resolve(file);
    save = file + Constants.SAVE;
  }

  if(sync && file && typeof file === 'string') {
    try {
      fs.writeFileSync(save, encoder.parse(this._lines));
      fs.renameSync(save, file);
    }catch(e) {
      /* istanbul ignore next: hard to mock a rename(2) error */
      return this.emit('error', e);
    }
    return encoder;
  }

  if(file instanceof Writable) {
    stream = file;
  }else{
    stream = fs.createWriteStream(save, this.options.read)
  }

  this.once('write', cb);

  function onFinish() {

    function onRename(err) {
      encoder.removeAllListeners('error');
      stream.removeAllListeners('error');
      /* istanbul ignore next: hard to mock a rename(2) error */
      if(err) return this.emit('error', err);
      this.emit('write', this);
    }

    onRename = onRename.bind(this);

    if(save) {
      fs.rename(save, file, onRename);
    }else{
      onRename();
    }

  }

  var onError = this.onError.bind(this);
  encoder.on('error', onError);
  stream.on('error', onError);

  stream.on('finish', onFinish.bind(this));
  encoder.pipe(stream);

  if((lines.length % size) !== 0) len++;

  // not a very large config
  if(lines.length < size) {
    encoder.end(lines);
    return encoder;
  }

  // split the work for larger config files
  function writeLines() {
    var chunk = lines.slice(i * size, (i * size) + size);

    // all done
    if(!chunk.length) {
      return encoder.end();
    }

    // ensure we get correct line break between
    // line chunks, the encoder joins lines on EOL
    // this means that the last line in the chunk array
    // does not have an EOL, we need to ensure it does
    if(i > 0) {
      chunk.unshift('');
    }

    // write out the line chunk
    encoder.write(chunk);
    setImmediate(writeLines);
    i++;
  }

  writeLines();
  return encoder;
}
716096
function readFile(p, encoding) {
    var def = Q.defer();
    fs.readFile(p, encoding, def.makeNodeResolver());
    return def.promise
}
174348
function writeFile(filePath, contents) {
  return new Promise((resolve, reject) => {
    fs.writeFile(filePath, contents, 'utf-8', (err, file) => {
      err ? reject(err) : resolve();
    })
  });
}
262839
public static function appendTo($src, $dest, $newline = false) {

        // Open the destination.
        $reader = @fopen($src, "r");
        if (false === $reader) {
            throw new FileNotFoundException($src);
        }

        // Open the destination.
        $writer = @fopen($dest, "a");
        if (false === $writer) {
            throw new IOException(sprintf("Failed to open \"%s\"", $dest));
        }

        // Append the source into destination.
        if (false === @file_put_contents($dest, $reader, FILE_APPEND)) {
            throw new IOException(sprintf("Failed to append \"%s\" into \"%s\"", $src, $dest));
        }

        // Append a new line.
        if (true === $newline && false === @file_put_contents($dest, "\n", FILE_APPEND)) {
            throw new IOException(sprintf("Failed to append \"%s\" into \"%s\"", $src, $dest));
        }

        // Close the files.
        if (false === @fclose($reader)) {
            throw new IOException(sprintf("Failed to close \"%s\"", $src));
        }
        if (false === @fclose($writer)) {
            throw new IOException(sprintf("Failed to close \"%s\"", $dest));
        }
    }
378827
protected void saveNewFunctionToFile(final String newFunctionClass) throws Exception {
        info("");
        info(SAVE_FILE);

        final File packageDir = getPackageDir();

        final File targetFile = getTargetFile(packageDir);

        createPackageDirIfNotExist(packageDir);

        saveToTargetFile(targetFile, newFunctionClass);

        info(SAVE_FILE_DONE + targetFile.getAbsolutePath());
    }
1189230
protected boolean writeFile(QualifiedName name, ExtraLanguageAppendable appendable, IExtraLanguageGeneratorContext context) {
		final ExtraLanguageAppendable fileAppendable = createAppendable(null, context);
		generateFileHeader(name, fileAppendable, context);

		final ImportManager importManager = appendable.getImportManager();
		if (importManager != null && !importManager.getImports().isEmpty()) {
			for (final String imported : importManager.getImports()) {
				final QualifiedName qn = getQualifiedNameConverter().toQualifiedName(imported);
				generateImportStatement(qn, fileAppendable, context);
			}
			fileAppendable.newLine();
		}

		fileAppendable.append(appendable.getContent());
		final String content = fileAppendable.getContent();

		if (!Strings.isEmpty(content)) {
			final String fileName = toFilename(name, FILENAME_SEPARATOR);
			final String outputConfiguration = getOutputConfigurationName();
			if (Strings.isEmpty(outputConfiguration)) {
				context.getFileSystemAccess().generateFile(fileName, content);
			} else {
				context.getFileSystemAccess().generateFile(fileName, outputConfiguration, content);
			}
			return true;
		}
		return false;
	}