How to use the osenv.tmpdir function in osenv

To help you get started, we’ve selected a few osenv 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 npm / pacote / lib / handlers / git / tarball.js View on Github external
function withTmp (opts, cb) {
  if (opts.cache) {
    // cacache has a special facility for working in a tmp dir
    return cache.tmp.withTmp(opts.cache, {tmpPrefix: 'git-clone'}, cb)
  } else {
    const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp')
    const tmpName = uniqueFilename(tmpDir, 'git-clone')
    const tmp = mkdirp(tmpName).then(() => tmpName).disposer(rimraf)
    return BB.using(tmp, cb)
  }
}
github npm / pacote / lib / fetchers / git.js View on Github external
function withTmp (opts, cb) {
  if (opts.cache) {
    // cacache has a special facility for working in a tmp dir
    return cacache.tmp.withTmp(opts.cache, { tmpPrefix: 'git-clone' }, cb)
  } else {
    const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp')
    const tmpName = uniqueFilename(tmpDir, 'git-clone')
    const tmp = mkdirp(tmpName).then(() => tmpName).disposer(rimraf)
    return BB.using(tmp, cb)
  }
}
github Level / party / test / bytewise.js View on Github external
var test = require('tape')
var level = require('..')
var path = require('path')
var bytewise = require('bytewise')
var tmpdir = require('osenv').tmpdir()
var datadir = path.join(tmpdir, 'level-party-' + Math.random())

var lopts = { keyEncoding: bytewise, valueEncoding: 'json' }

test('bytewise key encoding', function (t) {
  t.plan(7)
  var adb = level(datadir, lopts)
  var bdb = level(datadir, lopts)
  var value = Math.floor(Math.random() * 100000)

  adb.put(['a'], value, function (err) {
    t.ifError(err)

    bdb.get(['a'], function (err, x) {
      t.ifError(err)
      t.equal(x, value)
github Level / party / test / bytewise_sublevel.js View on Github external
var test = require('tape');
var level = require('../');
var path = require('path');
var bsub = require('level-sublevel/bytewise');
var os = require('os');
var tmpdir = require('osenv').tmpdir();
var datadir = path.join(tmpdir, 'level-party-' + Math.random());
var bytewise = require('bytewise');

var lopts = { keyEncoding: bytewise, valueEncoding: 'json' };

test('bytewise sublevel', function (t) {
    t.plan(5);
    var a = level(datadir);
    var b = level(datadir);
    var adb = bsub(a, lopts);
    var bdb = bsub(b, lopts);
    var value = Math.floor(Math.random() * 100000);
    
    adb.put([ 'a' ], value, function (err) {
        if (err) t.fail(err);
        var times = 0;
github Level / party / test / sublevel.js View on Github external
var test = require('tape');
var level = require('../');
var path = require('path');
var sub = require('level-sublevel');
var os = require('os');
var tmpdir = require('osenv').tmpdir();
var datadir = path.join(tmpdir, 'level-party-' + Math.random());

test('sublevel', function (t) {
    t.plan(6);
    var db = level(datadir);
    var sdb = sub(db);
    var a = sdb.sublevel('aaa', { valueEncoding: 'json' });
    var b = sdb.sublevel('bbb', { valueEncoding: 'json' });
    
    var value = Math.floor(Math.random() * 100000);
    
    a.put('x', value, function (err) {
        t.ifError(err);
        
        a.get('x', function (err, x) {
            t.ifError(err);
github mcollina / mosca / test / persistence / levelup_spec.js View on Github external
"use strict";

var abstract = require("./abstract");
var LevelUp = require("../../").persistence.LevelUp;
var async = require("async");
var tmpdir = require("osenv").tmpdir();
var path = require("path");
var rimraf = require("rimraf");

describe("mosca.persistence.LevelUp", function() {

  this.timeout(4000);

  var opts = {
    ttl: {
      subscriptions: 250,
      packets: 250
    }
  };

  abstract(LevelUp, function(cb) {
    var that = this;
github mafintosh / torrent-blob-store / index.js View on Github external
var torrents = require('torrent-stream')
var duplexify = require('duplexify')
var createTorrent = require('create-torrent')
var parseTorrent = require('parse-torrent')
var fs = require('fs');
var path = require('path');
var tmpdir = require('osenv').tmpdir();
var mkdirp = require('mkdirp')
var once = require('once')
var xtend = require('xtend')
var crypto = require('crypto')

var TorrentBlobs = function(opts) {
  if (!(this instanceof TorrentBlobs)) return new TorrentBlobs(opts)
  this._options = opts || {}
  this._engines = {}
}

TorrentBlobs.prototype.createReadStream = function(opts) {
  if (typeof opts === 'string') opts = {key:opts}
  var result = duplexify()

  this._getFile(opts, function(file) {
github jasonsanjose / brackets-sass / node / 2.0.2 / node_modules / node-sass / node_modules / pangyp / lib / install.js View on Github external
function eaccesFallback () {
    var tmpdir = osenv.tmpdir()
    gyp.devDir = path.resolve(tmpdir, '.node-gyp')
    log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', osenv.user(), devDir)
    log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)
    if (process.cwd() == tmpdir) {
      log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')
      gyp.todo.push({ name: 'remove', args: argv })
    }
    gyp.commands.install(argv, cb)
  }
github aikar / timings / node_modules / node-sass / node_modules / pangyp / lib / install.js View on Github external
function eaccesFallback () {
    var tmpdir = osenv.tmpdir()
    gyp.devDir = path.resolve(tmpdir, '.node-gyp')
    log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', osenv.user(), devDir)
    log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)
    if (process.cwd() == tmpdir) {
      log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')
      gyp.todo.push({ name: 'remove', args: argv })
    }
    gyp.commands.install(argv, cb)
  }
github jxcore / jxcore / deps / npm / node_modules / node-gyp / lib / install.js View on Github external
function eaccesFallback () {
    var tmpdir = osenv.tmpdir()
    gyp.devDir = path.resolve(tmpdir, '.node-gyp')
    log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', osenv.user(), devDir)
    log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)
    if (process.cwd() == tmpdir) {
      log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')
      gyp.todo.push({ name: 'remove', args: argv })
    }
    gyp.commands.install(argv, cb)
  }

osenv

Look up environment settings specific to different operating systems

ISC
Latest version published 7 years ago

Package Health Score

55 / 100
Full package analysis

Popular osenv functions