gpt4 book ai didi

javascript - Node.js fs.accessSync 无法正常工作

转载 作者:太空宇宙 更新时间:2023-11-04 00:50:39 25 4
gpt4 key购买 nike

在 Windows 上,我有一个仅具有读取权限的共享文件夹,并且以下代码无法检测到该文件夹​​没有写入权限:

fs.accessSync("\\\\machine1\\shared",fs.W_OK);

我希望它按照文档抛出异常。

最佳答案

这是一个错误!我已记录以下问题:https://github.com/nodejs/node/issues/2949

引用自this comment :

See #1397 for background, it's the expected behavior insofar that it's not really possible to determine whether a folder is writable (without actually opening it) because that's controlled by the ACL, not the folder's metadata.

I don't think a reliable fix is possible so I'll close this out. Trying to open the folder in write-only mode isn't reliable either, it misreports when the folder is locked.

关于javascript - Node.js fs.accessSync 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32650125/

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