这是我的代码:
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()函数并打印到控制台“已写入文件!”但没有任何内容写入文件。 有人可以解决此问题或提出更好的解决方法。谢谢。