Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const pify = require('util').promisify;
const CoinstacClient = require('coinstac-client-core');
const rimraf = require('rimraf');
const dir = CoinstacClient.getDefaultAppDirectory();
/* eslint-disable no-console */
console.log(`Removing ${dir} …`);
pify(rimraf)(dir)
.then(() => console.log('Removed!'))
.catch(console.error);
/* eslint-enable no-console */
'use strict';
// find ~/.coinstac/* ! -name computations -maxdepth 0 -exec rm -rf '{}' \\;
const pify = require('util').promisify;
const CoinstacClient = require('coinstac-client-core');
const compact = require('lodash/compact');
const fs = require('fs');
const path = require('path');
const rimraf = require('rimraf');
const dir = CoinstacClient.getDefaultAppDirectory();
const rimrafAsync = pify(rimraf);
const statAsync = pify(fs.stat);
/* eslint-disable no-console */
console.log('Removing local dbs…');
pify(fs.readdir)(dir)
.then(files => Promise.all(files.map((file) => {
const fullPath = path.join(dir, file);
return statAsync(fullPath).then((stats) => {
return stats.isDirectory() && file !== 'computations'
? fullPath
: undefined;
});
})))