Not works fs.readFile in node js

后端 未结 5 778

I have:

 fs.readFile(\'../services/Prescipcion.xml\', \"utf8\", function (err, data) {
    console.log(\"err->\", err);
    console.log(\"data\", data);
 });
         


        
5条回答
  •  盖世英雄少女心
    2021-02-19 10:57

    When passing data over from a Web App to an Express server, the fs root resides under the Web App directory and NOT the server's root directory. Therefore, the first writeFile parameter must point to a directory outside the server directory, or link over to the server file tree.

提交回复
热议问题