Skip to content

Commit b09f1af

Browse files
authored
Merge pull request #248 from opensource9ja/240-fs-in-browser
remove filesystem check in browser enviroment
2 parents 264001d + ef234cb commit b09f1af

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

danfojs-browser/src/core/frame.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,8 @@ export class DataFrame extends Ndframe {
6666
*/
6767
async to_csv(csvFilePath = "") {
6868
const csvContent = await super.to_csv();
69-
// behave differently for Node vs Web
70-
if (typeof window === "undefined") {
71-
// Write CSV on Node.js
72-
// eslint-disable-next-line no-undef
73-
const fs = require("fs");
74-
fs.writeFileSync(
75-
csvFilePath,
76-
csvContent,
77-
(err) => err && console.error(err)
78-
);
79-
} else {
80-
// Download CSV on Web
81-
const webCSV = "data:text/csv;charset=utf-8," + csvContent;
82-
window.open(encodeURI(webCSV));
83-
}
69+
const webCSV = "data:text/csv;charset=utf-8," + csvContent;
70+
window.open(encodeURI(webCSV));
8471
return csvContent;
8572
}
8673

0 commit comments

Comments
 (0)