@pujansrt/data-genie
Version:
High performant ETL engine written in TypeScript
23 lines (22 loc) • 594 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonWriter = void 0;
const fs_1 = require("fs");
class JsonWriter {
constructor(filePath) {
this.records = [];
this.filePath = filePath;
}
async write(record) {
this.records.push(record);
}
async writeAll(records) {
for await (const record of records) {
this.records.push(record);
}
}
async close() {
(0, fs_1.writeFileSync)(this.filePath, JSON.stringify(this.records, null, 2));
}
}
exports.JsonWriter = JsonWriter;