mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 04:56:00 +00:00
16 lines
418 B
JavaScript
16 lines
418 B
JavaScript
const fs = require('fs-extra');
|
|
|
|
async function saveFreeTableData(file, data) {
|
|
const { structure, rows } = data;
|
|
const fileStream = fs.createWriteStream(file);
|
|
await fileStream.write(JSON.stringify({ __isStreamHeader: true, ...structure }) + '\n');
|
|
for (const row of rows) {
|
|
await fileStream.write(JSON.stringify(row) + '\n');
|
|
}
|
|
await fileStream.close();
|
|
}
|
|
|
|
module.exports = {
|
|
saveFreeTableData,
|
|
};
|