Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
}
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)
}
}
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)
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;
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);
"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;
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) {
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)
}
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)
}
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)
}