gpt4 book ai didi

node.js - 将目录存储在运行 node.js 脚本的变量中?

转载 作者:太空宇宙 更新时间:2023-11-04 03:10:29 26 4
gpt4 key购买 nike

如果我在 Windows 中的 C:\temp 中运行 Node 脚本,我如何找出该脚本运行的目录(如何找到脚本本身在文件系统中所在位置的路径?)

fs module documentation似乎没有回答这个问题。

最佳答案

__dirname应该可以解决问题。

关于node.js - 将目录存储在运行 node.js 脚本的变量中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22209709/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com