我正在开发一个应用程序,该应用程序应将文件系统路径作为目录,然后在该路径上进行进一步处理。代码被写入javascript。我不想使用 Node.js 或任何外部库进行验证。
我们只想给出路径:C:/Users/Desktop/Test_Folder
我们如何在 js 中验证该路径?
我们需要能够在 Windows、Linux 和 Mac OS 上运行的解决方案。
最佳答案
如果这只是浏览器中的应用程序,那么通常是不可能的。请参阅以下问题:
Local file access with javascript
https://stackoverflow.com/questions/24369131/is-html5-file-api-dead
List local directory on Web Application
有人尝试 standardized file system API ,已停产。看来它只能在 Chrome 中运行。
更新
Use the chrome.fileSystem API to create, read, navigate, and write to the user's local file system. With this API, Chrome Apps can read and write to a user-selected location. For example, a text editor app can use the API to read and write local documents. All failures are notified via chrome.runtime.lastError.
关于javascript - 如何验证本地文件系统目录路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26382637/