Create temporary storage folder used by mutler to store files before
uploading to permanent storage
175202
function createTemporaryStorageFolder() {
  fs.mkdir(imageDir, '0775', function(err) {
    if (err && err.code !== 'EEXIST') {
      console.log(err);
      throw new Error(err);
    }
  });
}
220436
def save(dir = Dir.pwd, config = {}, type = :local, options = {})
      conffile = config_file(dir, type, options)
      confdir  = File.dirname( conffile )
      unless File.directory?( confdir )
        warning "about to create the configuration directory #{confdir}"
        really_continue?  unless options[:no_interaction]
        run %( mkdir -p #{confdir} )
      end
      store_config(conffile, config, options)
    end
591468
@Override
    protected void initializeStorage( File directory ) throws BinaryStoreException {
        // make sure the directory doesn't exist
        FileUtil.delete(directory);
        if (!directory.exists()) {
            logger.debug("Creating temporary directory for transient binary store: {0}", directory.getAbsolutePath());
            directory.mkdirs();
        }
        if (!directory.canRead()) {
            throw new BinaryStoreException(JcrI18n.unableToReadTemporaryDirectory.text(directory.getAbsolutePath(),
                                                                                       JAVA_IO_TMPDIR));
        }
        if (!directory.canWrite()) {
            throw new BinaryStoreException(JcrI18n.unableToWriteTemporaryDirectory.text(directory.getAbsolutePath(),
                                                                                        JAVA_IO_TMPDIR));
        }
    }
1204321
def save(title='Save', parent=None, current_name='', folder=None,
         _before_run=None, _before_overwrite=None):
    """"""
    filechooser = gtk.FileChooserDialog(title, parent,
                                        gtk.FILE_CHOOSER_ACTION_SAVE,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                         gtk.STOCK_SAVE, gtk.RESPONSE_OK))
    if current_name:
        filechooser.set_current_name(current_name)
    filechooser.set_default_response(gtk.RESPONSE_OK)

    if folder:
        filechooser.set_current_folder(folder)

    path = None
    while True:
        if _before_run:
            _before_run(filechooser)
            _before_run = None  # XXX: find better implications
        response = filechooser.run()
        if response != gtk.RESPONSE_OK:
            path = None
            break

        path = filechooser.get_filename()
        if not os.path.exists(path):
            break

        if ask_overwrite(path, parent, _before_run=_before_overwrite):
            break
        _before_overwrite = None  # XXX: same
    _destroy(filechooser)
    return path
1224064
def atomic_create_file(file_path):
    """"""
    fd, tmp_file_path = tempfile.mkstemp(
        prefix=os.path.basename(file_path), dir=os.path.dirname(file_path), suffix=".metadata_tmp"
    )
    try:
        with os.fdopen(fd, "w") as out_file:
            yield out_file

        os.rename(tmp_file_path, file_path)
    except Exception:  # pytest: disable=broad-except
        with contextlib.suppress(Exception):
            os.unlink(tmp_file_path)
        raise
424066
def new_temp_file(directory=None, hint=''):
    ''''''
    return tempfile.NamedTemporaryFile(
        prefix='tmp-wpull-{0}-'.format(hint), suffix='.tmp', dir=directory)
806866
def _get_file(self):
        '''
        
        '''
        f = tempfile.NamedTemporaryFile(delete=False)
        self.tmp_files.add(f.name)
        return f
99559
def insert_paths(self, cache_key, paths):
    """"""
    with self._tmpfile(cache_key, 'write') as tmp:
      self._artifact(tmp.name).collect(paths)
      yield self._store_tarball(cache_key, tmp.name)
791185
def append(self, newContent, keep=True):
        
        content = self.__content + newContent
        if keep:
            self.__content = content

        if self.__needsRewrite:
            """
            Replace the content of the file.
            A temporary file is used to avoid loss of data through an interrupt.
            """
            tmpFilename = self.filename + ".tmp"

            util.write_file(content, tmpFilename)

            os.rename(tmpFilename, self.filename)
        else:
            with open(self.filename, "a") as file:
                file.write(newContent)

        self.__needsRewrite = not keep
958992
def _create_storage_directories():
        """"""
        # Create configuration directory
        if not os.path.exists(common.CONFIG_DIR):
            os.makedirs(common.CONFIG_DIR)
        # Create data directory (for log file)
        if not os.path.exists(common.DATA_DIR):
            os.makedirs(common.DATA_DIR)
        # Create run directory (for lock file)
        if not os.path.exists(common.RUN_DIR):
            os.makedirs(common.RUN_DIR)
1149838
def temporary(cls):
        
        fh, path = tempfile.mkstemp(suffix='.hdf5')
        os.close(fh)
        self = cls(path, 'w')
        self.path = path
        return self
995888
function generateDownloadsDir() {
    // Create temporary directory for file uploads
    let dloads = path.join(path.dirname(require.main.filename), 'download');

    if (!fs.existsSync(dloads)) {
        fs.mkdirSync(dloads);
    }

    let files = fs.readdirSync(dloads);

    for (let ix = 0; ix < files.length; ++ix) {
        fs.unlinkSync(path.join(dloads, files[ix]));
    }

    return dloads;
}
1255793
protected function saveToTempFile()
    {
        // Convert uploaded file to an array
        $aFiles = [];
        foreach($this->aUserFiles as $sVarName => $aUserFiles)
        {
            $aFiles[$sVarName] = [];
            foreach($aUserFiles as $aUserFile)
            {
                 $aFiles[$sVarName][] = $aUserFile->toTempData();
            }
        }
        // Save upload data in a temp file
        $sUploadDir = $this->getUploadTempDir();
        $this->sTempFile = uniqid();
        file_put_contents($sUploadDir . $this->sTempFile . '.json', json_encode($aFiles));
    }
902681
private Path createTemporaryStorage() {
        try {
            Path tempDir = Files.createTempDirectory("selenium");
            tempDir.toFile().deleteOnExit();

            log.info("Download storage location is: " + tempDir.toString());
            return tempDir;
        } catch (IOException e) {
            throw new CitrusRuntimeException("Could not create temporary storage", e);
        }
    }
1271068
def store(self):
        
        output = tempfile.NamedTemporaryFile(suffix='.json')
        try:

            def write(o):
                line = json.dumps(o, default=json_default)
                return output.write(line + '\n')

            yield write

            output.seek(0)
            log.info("Uploading generated table (%s)...", self._obj)
            self.save_file(output.name, destructive=True)
        finally:
            try:
                output.close()
            except:
                pass
1231456
private function prepareTmpDir()
    {
        $tempDir = $this->file->get(self::SETTING_DESTINATION_DIR) . DIRECTORY_SEPARATOR . uniqid('install-');

        // If the temporary folder could not be created, error out.
        // @codingStandardsIgnoreStart - we silence on purpose here as we create an exception on error.
        if (!@mkdir($tempDir, 0700)) {
        // @codingStandardsIgnoreEnd
            throw new \RuntimeException('Could not create the temporary directory');
        }

        $this->tempDir = $tempDir;
    }
1143350
def createHiddenFolder(self) -> 'File':
        

        if not self._autoDelete:
            raise Exception("Hidden folders can only be created within"
                            " an autoDelete directory")
        return tempfile.mkdtemp(dir=self._path, prefix=".")