无法在ReactJS中打印到文件

时间:2019-03-15 06:27:01

标签: reactjs

这是我的代码:

var fs = require('browserify-fs');

this.state = {

      idList: [],
};

    Submit = (event) => {
    const { idList } = this.state;
    //const {print} = fs.writeFile('C:/Users/Shreyas Joshi/Desktop/Transil-Internship/node-server-upload/uploads/idList.txt', idList, function(err) {});
    fs.mkdir('C:/Users/Shreyas Joshi/Desktop/Transil-Internship/ABHINAV/general-template', function() {
      fs.writeFile('C:/Users/Shreyas Joshi/Desktop/Transil-Internship/ABHINAV/general-template/idList.txt', idList, function() {
          console.log("written to file!");

      });
  });
    this.setState({
    });

  }

它正在进入fs.writeFile()函数并打印到控制台“已写入文件!”但没有任何内容写入文件。 有人可以解决此问题或提出更好的解决方法。谢谢。

0 个答案:

没有答案