17 lines
328 B
JavaScript
17 lines
328 B
JavaScript
|
const fs = require('fs');
|
||
|
|
||
|
function createFile(saveDir, rows, fileName) {
|
||
|
|
||
|
var stream = fs.createWriteStream(path.join(saveDir, fileName));
|
||
|
|
||
|
stream.once('open', function (fd) {
|
||
|
|
||
|
rows.forEach(element => {
|
||
|
stream.write(element);
|
||
|
});
|
||
|
|
||
|
stream.end();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = createFile
|