PHP 8.2.30
Preview: tmp.js Size: 879 B
/lib/node_modules/npm/node_modules/cacache/lib/util/tmp.js

'use strict'

const BB = require('bluebird')

const figgyPudding = require('figgy-pudding')
const fixOwner = require('./fix-owner')
const path = require('path')
const rimraf = BB.promisify(require('rimraf'))
const uniqueFilename = require('unique-filename')

const TmpOpts = figgyPudding({
  tmpPrefix: {}
})

module.exports.mkdir = mktmpdir
function mktmpdir (cache, opts) {
  opts = TmpOpts(opts)
  const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix)
  return fixOwner.mkdirfix(cache, tmpTarget).then(() => {
    return tmpTarget
  })
}

module.exports.withTmp = withTmp
function withTmp (cache, opts, cb) {
  if (!cb) {
    cb = opts
    opts = null
  }
  opts = TmpOpts(opts)
  return BB.using(mktmpdir(cache, opts).disposer(rimraf), cb)
}

module.exports.fix = fixtmpdir
function fixtmpdir (cache) {
  return fixOwner(cache, path.join(cache, 'tmp'))
}

Directory Contents

Dirs: 0 × Files: 5

Name Size Perms Modified Actions
3.22 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
159 B lrw-r--r-- 2021-03-10 14:36:36
Edit Download
1.72 KB lrw-r--r-- 2021-03-10 14:36:36
Edit Download
879 B lrw-r--r-- 2021-03-10 14:36:36
Edit Download
538 B lrw-r--r-- 2021-03-10 14:36:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).