bb.coroutine(function * (src) { yield bb.all(toArray(src).map(g => rimraf(g))) })
function cleanTmp (cache, opts) { opts.log.silly('verify', 'cleaning tmp directory') return rimraf(path.join(cache, 'tmp')) }
function makeTmp (cache, opts) { const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), opts.tmpPrefix) return fixOwner.mkdirfix( path.dirname(tmpTarget), opts.uid, opts.gid ).then(() => ({ target: tmpTarget, moved: false })).disposer(tmp => (!tmp.moved && rimraf(tmp.target))) }
/** * Remove directory content with rimraf on each file * Skips dot files * @todo test? * @param string path * @return Promise */ var removeDirectoryContent = function(path) { return fs.readdirAsync(path) .filter(noDotFiles) .map(function(filename) { return rimraf(p.resolve(path, filename)) }) }
function all (cache) { memo.clearMemoized() return rimraf(path.join(cache, '*(content-*|index-*)')) }
function rm (cache, integrity) { return hasContent(cache, integrity).then(content => { if (content) { const sri = content.sri if (sri) { return rimraf(contentPath(cache, sri)).then(() => true) } } else { return false } }) }
function verifyContent (filepath, sri) { return fs.statAsync(filepath).then(stat => { const contentInfo = { size: stat.size, valid: true } return ssri.checkStream( fs.createReadStream(filepath), sri ).catch(err => { if (err.code !== 'EINTEGRITY') { throw err } return rimraf(filepath).then(() => { contentInfo.valid = false }) }).then(() => contentInfo) }).catch({ code: 'ENOENT' }, () => ({ size: 0, valid: false })) }
test('cleanup', t => { server.close() return rimraf(testDir) })
rimraf(EXAMPLE_DIR + 'tmp') .then(function () { console.log('success'); });
test('cleanup', t => { return rimraf(testDir) })
test('cleanup', t => { server.close() return rimraf(testDir) })
rimraf(EXAMPLE_DIR + 'tmp') .then(function () { console.log('success'); });
test('cleanup', t => { return rimraf(testDir) })
test('cleanup', () => rimraf(testDir))