javascript - 如何验证本地文件系统目录路径?

标签 javascript

我正在开发一个应用程序,该应用程序应将文件系统路径作为目录,然后在该路径上进行进一步处理。代码被写入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 中运行。

更新

引自Chrome documentation :

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/

相关文章:

javascript - Promise 解析后在 'then' 中发送响应

javascript - VueJS Webpack 在哪里添加插件

javascript - 强制 !important 类与 js-jquery

javascript - Node.js 中的同步 for in 循环

javascript - 任务 "default"不在您的 gulpfile 中

javascript - DOM 和 JavaScript

javascript - 如何检查添加的类(class)是否有视频然后播放

javascript - 在 http 请求上加载 Angular Spinner

javascript - 如何根据选定的选项文本选择 <select> 元素?

javascript - 如何使用 jQuery 在按钮单击时显示下一个 div?