updateIndexForFile(file) { const filePath = path.relative(this.basePath, file); this.files.push(filePath); return fs.readFile(path.join(this.basePath, filePath), 'utf8') .then(content => { const doc = { file: filePath, filename: path.basename(filePath, path.extname(filePath)), content }; this.index[this.index.documentStore.hasDoc(filePath) ? 'updateDoc' : 'addDoc'](doc); return doc; }); }
getContent(file) { return this.index.documentStore.getDoc(file).content; }