有没有什么 JS 库 可以获取 文件夹名称/以及目录下的文件名称等

2016-12-28 00:24:30 +08:00
 HLT
2674 次点击
所在节点    程序员
19 条回复
airyland
2016-12-28 00:30:28 +08:00
这原生接口就能实现吧, npm 库也很多,比如 walk https://npm.taobao.org/package/walk
HLT
2016-12-28 00:34:24 +08:00
@airyland 呃 还有吗
SoloCompany
2016-12-28 01:34:37 +08:00
airyland
2016-12-28 07:20:04 +08:00
@HLT 自行 google
araraloren
2016-12-28 08:54:58 +08:00
~~ 这问的时间已经写完几个了吧
Rice
2016-12-28 09:11:58 +08:00
node 不是有 API 吗
ferrum
2016-12-28 10:03:03 +08:00
node-directory-tree, complete-directory-tree on Github/npm
tobeyouth
2016-12-28 10:09:29 +08:00
fs 直接就可以
xylitolLin
2016-12-28 10:59:21 +08:00
你是说浏览器的 js 还是 node.js
HLT
2016-12-28 15:30:43 +08:00
@araraloren 哎,智商不够啊

@Rice
@ferrum
@SoloCompany
不会 nodejs 原谅我
HLT
2016-12-28 15:31:20 +08:00
@xylitolLin 浏览器
xylitolLin
2016-12-28 15:47:46 +08:00
@HLT 除了 ie ,其他浏览器没有办法,不要想了,这是基于安全理由
HLT
2016-12-28 16:12:25 +08:00
@xylitolLin 嗯,在用 PHP 来解决了。。。
SoloCompany
2016-12-28 16:40:01 +08:00
浏览器读文件,你是在逗我们?
HLT
2016-12-28 17:06:29 +08:00
@SoloCompany 你想多了。。。只是去获取目录下文件名称
HLT
2016-12-28 17:08:35 +08:00
@SoloCompany ![)_%QNLEF3ERR$[%M9_]B41I.jpg]( https://ooo.0o0.ooo/2016/12/28/586381037ef0d.jpg)
lslqtz
2016-12-28 17:20:05 +08:00
@HLT PHP 读文件,是服务端的?那 js 也可以,读本地 PHP 服务端也读不过来的
Sparetire
2016-12-28 22:27:40 +08:00
浏览器端,通过 File API 或许有可能实现,参考这篇 https://www.cnblogs.com/index-html/p/dialog-phishing.html
LeoEatle
2016-12-29 01:57:47 +08:00
。。。__dirname?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/330620

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX