Do you need to use path.join in node.js?

后端 未结 4 1591
我在风中等你
我在风中等你 2020-11-27 13:53

as everyone knows Windows does paths with backslashes where Unix does paths with forward slashes. node.js provides path.join() to always use the correct slash. So for exampl

4条回答
  •  旧时难觅i
    2020-11-27 14:12

    I use path.join to ensure folder separators are in the correct places, not necessarily to ensure that it uses forward versus back slashes. For example:

    path.join("/var/www", "test")
    

    Will correctly insert the separator between www and test /var/www/test

提交回复
热议问题