Can not use in browser side.
KaiOrange opened this issue · 2 comments
KaiOrange commented
TypeError: fs.readFileSync is not a function
Can not use in browser side.
sindresorhus commented
The module is for Node.js, not the browser.
KaiOrange commented
I wrote a node script. It help me to convert the TXT file into a json file.
const cows = require("cows");
const fs = require("fs");
const path = require("path");
const cowsArray = cows();
fs.writeFileSync(path.join(__dirname, 'cows.json'), JSON.stringify(cowsArray),'utf8');
So I can import the file this way
const cowsArray = require("./cows.json");