How to use the buttercup/dist/buttercup-web.min.DatasourceAdapter.registerDatasource function in buttercup

To help you get started, we’ve selected a few buttercup 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 buttercup / buttercup-desktop / src / shared / buttercup / ipc-datasource.js View on Github external
import fs from 'fs';
import {
  TextDatasource,
  DatasourceAdapter
} from 'buttercup/dist/buttercup-web.min';

const registerDatasource = DatasourceAdapter.registerDatasource;

/**
 * Datasource for Ipc archives
 * @augments TextDatasource
 */
export class IpcDatasource extends TextDatasource {
  constructor(filePath) {
    super('');
    this.path = filePath;
  }

  load(password) {
    return Promise.resolve(fs.readFileSync(this.path, 'utf8')).then(content => {
      this.setContent(content);
      return super.load(password);
    });