How to use the fs-temp.template function in fs-temp

To help you get started, we’ve selected a few fs-temp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tessel / t2-cli / lib / install / rust.js View on Github external
return new Promise((resolve) => {
    var dir = fsTemp.template('t2-sdk-%s').mkdirSync();
    resolve({
      path: dir,
      cleanup: () => {
        try {
          fs.removeSync(dir);
        } catch (e) {
          // If the folder no longer exists, or if the remove operation throws
          // some error, this is non-fatal to the user (the data will just
          // exist until the temp folder is cleaned) and so we swallow any
          // errors.
        }
      }
    });
  });
}
github fox1t / fastify-multer / test / functionality.ts View on Github external
destination: function(req, f, cb) {
        temp.template('testforme-%s').mkdir(function(err, uploadDir) {
          if (err) {
            return cb(err, '')
          }

          cleanup.push(uploadDir)
          cb(null, uploadDir)
        })
      },
      filename: generateFilename,
github fox1t / fastify-multer / test / functionality.js View on Github external
destination: function (req, file, cb) {
        temp.template('testforme-%s').mkdir(function (err, uploadDir) {
          if (err) return cb(err)

          cleanup.push(uploadDir)
          cb(null, uploadDir)
        })
      },
      filename: generateFilename
github LinusU / node-appdmg / test / lib / visually-verify-image.js View on Github external
'use strict'

const fs = require('fs')
const temp = require('fs-temp').template('%s.png')
const looksSame = require('looks-same')
const spawnSync = require('child_process').spawnSync
const captureWindow = require('capture-window')
const sizeOf = require('image-size')

const hdiutil = require('../../lib/hdiutil')

const toleranceOpts = { tolerance: 20 }

function retry (fn, cb) {
  let triesLeft = 8

  function runIteration () {
    fn(function (err) {
      if (!err) return cb(null)
      if (--triesLeft === 0) return cb(err)
github koajs / multer / test / functionality.js View on Github external
destination: (req, file, cb) => {
        temp.template('testforme-%s').mkdir((err, uploadDir) => {
          if (err) return cb(err);

          cleanup.push(uploadDir);
          cb(null, uploadDir);
        });
      },
      filename: generateFilename
github LinusU / fs-xattr / test / xattr.js View on Github external
before(function () {
    path = temp.template('∞ %s').writeFileSync('')
  })
github LinusU / node-appdmg / lib / hdiutil.js View on Github external
exports.create = function (volname, size, cb) {
  temp.template('%s.dmg').writeFile('', function (err, outname) {
    if (err) return cb(err)

    const args = [
      'create', outname,
      '-ov',
      '-fs', 'HFS+',
      '-size', size,
      '-volname', volname
    ]

    util.sh('hdiutil', args, function (err) {
      if (!err) return cb(null, outname)

      fs.unlink(outname, () => cb(err))
    })
  })

fs-temp

`fs-temp` is a quick and simple way to create temporary files and directories.

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages