Write a single file to disk.
321012
def write_file(data, outfilename):
    """"""
    if not data:
        return False
    try:
        with open(outfilename, 'w') as outfile:
            for line in data:
                if line:
                    outfile.write(line)
        return True
    except (OSError, IOError) as err:
        sys.stderr.write('An error occurred while writing {0}:\n{1}'
                         .format(outfilename, str(err)))
        return False
896401
def saveDbf(self, target):
        """"""
        if not hasattr(target, "write"):
            target = os.path.splitext(target)[0] + '.dbf'
        self.dbf = self.__getFileObj(target)
        self.__dbfHeader()
        self.__dbfRecords()
98208
def write_data(data, out_file):
    """"""
    with open(out_file, 'w') as handle_out:
        handle_out.write(json.dumps([data], skipkeys=True, indent=2))
326788
function writeFile(pathToFile, content, verbose) {
  const directory = path.dirname(pathToFile);

  // Create directory if it doesn't exist
  if (!fs.existsSync(directory)) {
    fs.mkdirSync(directory);
  }

  // Try to write file to disk to the given location
  fs.writeFile(pathToFile, content, { flag: 'w' }, (error) => {
    if (error) {
      throw new Error(error);
    }

    // Log success message to the console if in verbose mode only
    if (verbose) {
      const successMessage = `\nVersion file written to ${chalk.green(pathToFile)}`;

      console.log(successMessage);
    }
  });
}
155847
def _write(self, str_buf):
    """"""
    self._filehandle.write(str_buf)
    self._buf_size += len(str_buf)
9118
def save(self, outfile):
        """"""
        if isinstance(outfile, compat.string_type):
            outfile = open(outfile, 'wb')
        assert hasattr(outfile, 'write') and callable(outfile.write), \
            "Expect a file or file-like object with a .write() method"
        outfile.write(self.data)
1098921
def write(file_name, data):
    """"""
    with open(file_name, 'w') as f:
        f.write(encode(data))
801676
def writefile(openedfile, newcontents):
    """"""
    openedfile.seek(0)
    openedfile.truncate()
    openedfile.write(newcontents)
636850
def writefile(filename, data, binary=False):
    
    try:
        flags = 'w' if not binary else 'wb'
        with open(filename, flags) as _file:
            _file.write(data)
            _file.flush()
            return True

    except (OSError, IOError):
        return False
778126
def write_single_file(dir, filename = nil)
      FileUtils.mkdir_p File.join(dir)

      # HACKY: NEED TO FIX
      keys = snapshots.first.keys
      keys = snapshots.first[@field].first.keys if @field

      s = []
      s << keys.join(SEPERATOR)
      snapshots.each do |snapshot|
        # HACKY: NEED TO FIX
        if @field
          snapshot[@field].each_with_index do |e, i|
            s << e.values.map do |v|
              if v.is_a?(String)
                "\"#{v}\""
              else
                "#{v}"
              end
            end.join(SEPERATOR)
          end
        else
          s << [*snapshot.values].map { |e|
            e.is_a?(String) ? "\"#{e}\""  : "#{e}"
          } .join(SEPERATOR)
        end
      end

      filename ||= @parser.class.name.split("::").last
      path = File.join(dir, filename)
      File.open("#{path}.csv", 'w') { |f| f.write(s.join("\n")) }
    end
1327150
def save_file(data, export_file):
    """"""
    create_dir(os.path.dirname(export_file))

    try:
        with open(export_file, "w") as file:
            file.write(data)
    except PermissionError:
        logging.warning("Couldn't write to %s.", export_file)
1197604
def write_file(file, b):
	
	if hasattr(file, "write_bytes"):
		file.write_bytes(b)
	elif hasattr(file, "write"):
		file.write(b)
	else:
		with open(file, "wb") as f:
			f.write(b)
1212
def write(self, chunk):
        """"""
        if self.chunked_write and chunk:
            chunk_size_hex = hex(len(chunk))[2:].encode('ascii')
            buf = [chunk_size_hex, CRLF, chunk, CRLF]
            self.conn.wfile.write(EMPTY.join(buf))
        else:
            self.conn.wfile.write(chunk)
602108
def write_to_file(self, f):
        """"""
        for section, values in self._values.iteritems():
            try:
                section_name, subsection_name = section
            except ValueError:
                (section_name, ) = section
                subsection_name = None
            if subsection_name is None:
                f.write("[%s]\n" % section_name)
            else:
                f.write("[%s \"%s\"]\n" % (section_name, subsection_name))
            for key, value in values.iteritems():
                f.write("%s = %s\n" % (key, _escape_value(value)))
1133117
function writeFileAtomic(filepath, data, cb) {

    var fullpath = u.join(self.path, filepath);
    var dir = path.dirname(fullpath);

    var tmppath = u.join(self.tmp, filepath);
    var tmpdir = path.dirname(tmppath);

    mkdirp(tmpdir, function(err) {
      if (err) return cb(err);

      mkdirp(dir, function(err) {
        if (err) return cb(err);

        fs.writeFile(tmppath, data, function(err) {
          if (err) return cb(err);

          fs.rename(tmppath, fullpath, function(err) {
            if (err) return cb(err);
            cb();
          });
        });
      });
    });
  }
453516
def write_file(self, name, path=None):
        """"""

        if path is None:
            path = name

        self.zf.write(path, name)
339962
def tofile(self, f):
        """"""
        f.write(pack(self.FILE_FMT, self.error_rate, self.num_slices,
                     self.bits_per_slice, self.capacity, self.count))
        (f.write(self.bitarray.tobytes()) if is_string_io(f)
         else self.bitarray.tofile(f))