TODO: Used?!
 Returns a new writeable File under the
359961
def new_output_file(filename = 'foo')
      File.new( File.expand_path(File.join(export_path, filename)), 'w+')
    end
53113
def new_file(self, path: str, checksum: str=None, to_archive: bool=False,
                 tags: List[models.Tag]=None) -> models.File:
        """"""
        new_file = self.File(path=path, checksum=checksum, to_archive=to_archive, tags=tags)
        return new_file
110047
def make_writeable(filename):
    
    if not os.access(filename, os.W_OK):
        st = os.stat(filename)
        new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR
        os.chmod(filename, new_permissions)
445542
def write(self):
        """"""
        if self._path is None:
            raise ValueError("Instance was not initialized with a path, use to_file(...) instead")
        # END assert path
        self.to_file(self._path)
        return self
1287831
def new(cls, arg):
        
        content = None

        if arg.kind == 'file':
            if os.path.exists(arg.value):
                with open(arg.value, 'r') as f:
                    content = f.read()
            else:
                raise Exception('File does not exist: {}'.format(arg.value))
        elif arg.kind == 'cli':
            content = arg.value

        for source_cls in cls.sources:
            if source_cls.supports_source(arg):
                return source_cls(content)

        msg = 'Unsupported Parameter Source "{}"'
        raise Execption(msg.format(arg.value))
494918
def write(temp_object, opts={})
      temp_object.file do |fd|
        File.new.tap do |file|
          file.metadata = temp_object.meta
          file.data     = fd
          file.save!
          return file.id.to_s
        end
      end
    end
154480
function fileSystem(context, file, fileSet, next) {
  var destinationPath

  if (!context.output) {
    debug('Ignoring writing to file-system')
    return next()
  }

  if (!file.data.unifiedEngineGiven) {
    debug('Ignoring programmatically added file')
    return next()
  }

  destinationPath = file.path

  if (!destinationPath) {
    debug('Cannot write file without a `destinationPath`')
    return next(new Error('Cannot write file without an output path'))
  }

  if (stats(file).fatal) {
    debug('Cannot write file with a fatal error')
    return next()
  }

  destinationPath = resolve(context.cwd, destinationPath)
  debug('Writing document to `%s`', destinationPath)

  file.stored = true

  writeFile(destinationPath, file.toString(), next)
}
944655
function() {
        var writer = new stream.Stream();

        writer.write = this.write;
        writer.end = this.end;

        return writer;
    }
395719
function newfile(filepath) {
  let dir = path.dirname(filepath);
  if (path.extname(filepath) === '.shp') dir = path.resolve(dir, '..');
  const name = crypto.randomBytes(8).toString('hex');
  return path.join(dir, name);
}
841082
public static File newFile(String fileName) {
		File file = new File(fileName);
		if(file.exists())
			file.delete();
		return file;
	}
886461
private File rollFile() throws IOException {
        // If the base file exists, rename it and recreate it.
        File file = new File(directory, fileName + fileExtension);
        if (file.isFile()) {
            // Reuse the file if it's already empty.
            if (file.length() == 0) {
                return file;
            }

            if (maxFiles == 1) {
                if (!FileLogUtils.deleteFile(file)) {
                    // We failed to delete the file and issued a message.
                    return file;
                }
            } else if (createNewUniqueFile(file) == null) {
                // We failed to rename (or copy + delete) the base file to a new
                // file, and we already issued a message.
                return file;
            }
        }

        if (!file.createNewFile()) {
            Tr.error(tc, "UNABLE_TO_DELETE_RESOURCE_NOEX", new Object[] { file });
        }

        return file;
    }
1175918
def get_new_file_writer(file)
      if File.extname(file) == '.gz'
        Zlib::GzipWriter.new(File.new(file, 'wb'))
      else
        File.new(file, 'wb')
      end
    end
173429
function File(file, options) {
  Item.call(this, file, options);
  this.initFile(file);
  return file;
}
720397
def _make_writeable(filename):
    
    import stat
    if sys.platform.startswith('java'):
        # On Jython there is no os.access()
        return
    if not os.access(filename, os.W_OK):
        st = os.stat(filename)
        new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR
        os.chmod(filename, new_permissions)
996582
def create_new_file(self, current_path, title, filters, create_func):
        """"""
        if current_path is None:
            current_path = ''
        if osp.isfile(current_path):
            current_path = osp.dirname(current_path)
        self.redirect_stdio.emit(False)
        fname, _selfilter = getsavefilename(self, title, current_path, filters)
        self.redirect_stdio.emit(True)
        if fname:
            try:
                create_func(fname)
                return fname
            except EnvironmentError as error:
                QMessageBox.critical(self, _("New file"),
                                     _("<b>Unable to create file <i>%s</i>"
                                       "</b><br><br>Error message:<br>%s"
                                       ) % (fname, to_text_string(error)))
953557
function (file) {
    return new File({
      pattern: this.pattern,
      recurse: this.recurse,
      dirname: file.dirname,
      segment: file.segment,
      path: file.path
    });
  }
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); 
      });
    });
  }