Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
});