|
|
@ -35,11 +35,16 @@ const hashesFromPinFile = (pinFile, fileName) => {
|
|
|
|
module.exports.load = function (cb) {
|
|
|
|
module.exports.load = function (cb) {
|
|
|
|
nThen((waitFor) => {
|
|
|
|
nThen((waitFor) => {
|
|
|
|
Fs.readdir('./pins', waitFor((err, list) => {
|
|
|
|
Fs.readdir('./pins', waitFor((err, list) => {
|
|
|
|
if (err) { throw err; }
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
if (err.code === 'ENOENT') {
|
|
|
|
|
|
|
|
dirList = [];
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
throw err;
|
|
|
|
|
|
|
|
}
|
|
|
|
dirList = list;
|
|
|
|
dirList = list;
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}).nThen((waitFor) => {
|
|
|
|
}).nThen((waitFor) => {
|
|
|
|
fileList.splice(0, fileList.length);
|
|
|
|
|
|
|
|
dirList.forEach((f) => {
|
|
|
|
dirList.forEach((f) => {
|
|
|
|
sema.take((returnAfter) => {
|
|
|
|
sema.take((returnAfter) => {
|
|
|
|
Fs.readdir('./pins/' + f, waitFor(returnAfter((err, list2) => {
|
|
|
|
Fs.readdir('./pins/' + f, waitFor(returnAfter((err, list2) => {
|
|
|
|