@dbml/cli
Version:
See our website [@dbml/cli](https://dbml.dbdiagram.io/cli/) for more information
29 lines (28 loc) • 784 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _fs = _interopRequireDefault(require("fs"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class OutputFilePlugin {
constructor(filePath, header) {
this.filePath = filePath;
this.header = header;
this.isWrite = false;
}
start() {
_fs.default.writeFileSync(this.filePath, '');
this.stream = _fs.default.createWriteStream(this.filePath, {
flags: 'a'
});
if (this.header) this.stream.write(this.header);
this.isWrite = true;
}
write(content) {
if (!this.isWrite) this.start();
this.stream.write(content);
}
}
var _default = OutputFilePlugin;
exports.default = _default;
;