[Node.js] Resolve path problem in all envs (require.resolve)
2021-03-31 01:25
标签:and for sync code nod read files res path When dealing with `fs` library, the common problem you will meet is the path to file. Different envs may have different way to handle the path. The best way which works for all is `require.resolve`: [Node.js] Resolve path problem in all envs (require.resolve) 标签:and for sync code nod read files res path 原文地址:https://www.cnblogs.com/Answer1215/p/14592332.html const script = fs.readFileSync(require.resolve("./image.js"), "utf-8");
上一篇:js-null的使用场景
下一篇:简单的HTML下拉框
文章标题:[Node.js] Resolve path problem in all envs (require.resolve)
文章链接:http://soscw.com/index.php/essay/70238.html