Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
co(function *() {
var dataPath = getFullDataPath() + '/images';
return (
(yield cofs.exists(dataPath)) &&
(yield cofs.stat(dataPath)).isDirectory()
);
})(next);
};
var makeDataPath = function *(basepath, name) {
var alt = '';
while (true) {
var path = basepath + '/' + name + alt + '_data';
if (yield cofs.exists(path)) {
alt = '_' + shortId.generate();
}
else {
yield cofs.mkdir(path);
yield cofs.mkdir(path + '/images');
return './' + name + alt + '_data';
}
}
};
function *ensure(pathToBook) {
var pathToDirectory = path.dirname(pathToBook);
if (!(yield fs.exists(pathToDirectory))) {
yield fs.mkdir(pathToDirectory);
}
}