Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async buildBuffer(absoluteFilePath) {
const params = {
shouldDestroyOnFileDelete: this.shouldDestroyBufferOnFileDelete
};
let buffer;
if (absoluteFilePath != null) {
if (this.loadPromisesByPath[absoluteFilePath] == null) {
this.loadPromisesByPath[absoluteFilePath] = TextBuffer.load(
absoluteFilePath,
params
)
.then(result => {
delete this.loadPromisesByPath[absoluteFilePath];
return result;
})
.catch(error => {
delete this.loadPromisesByPath[absoluteFilePath];
throw error;
});
}
buffer = await this.loadPromisesByPath[absoluteFilePath];
} else {
buffer = new TextBuffer(params);
}