const cleanCache = async () => { await rimrafAsync(store.getState().config.tmpPath, fs) await mkdirp.mkdirpAsync(store.getState().config.tmpPath) await rimrafAsync(store.getState().config.tmpTransPath, fs) await mkdirp.mkdirpAsync(store.getState().config.tmpTransPath) await rimrafAsync(store.getState().config.thumbPath, fs) await mkdirp.mkdirpAsync(store.getState().config.thumbPath) await rimrafAsync(store.getState().config.imagePath, fs) await mkdirp.mkdirpAsync(store.getState().config.imagePath) // await rimrafAsync(store.getState().config.boxPath, fs) // await mkdirp.mkdirpAsync(store.getState().config.boxPath, fs) return true }
.then(conversations => // Create the base directory if it doesn't exist yet mkdirp.mkdirpAsync(basePath) .then(() => // Write the `conversations.json` file to it fs.writeFileAsync(path.join(basePath, 'conversations.json'), JSON.stringify(conversations, null, 2)) ) .then(() => conversations)