folderToDocuments(linksPath) .each(result => { index.addDoc(result); }) .done(() => { const indexJSON = index.toJSON(); fs.writeFile(indexPath, JSON.stringify(indexJSON), () => { console.log('Successfully saved index!'); }); });
.done(() => { if (shouldThrow) { throw new Error('Possible duplicate detected!');