How to use the text-buffer.load function in text-buffer

To help you get started, we’ve selected a few text-buffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atom / atom / src / project.js View on Github external
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);
    }

text-buffer

A container for large mutable strings with annotated regions

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages