V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
HLT
V2EX  ›  程序员

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

  •  
  •   HLT · 2016-12-28 00:24:30 +08:00 · 2649 次点击
    这是一个创建于 2683 天前的主题,其中的信息可能已经有所发展或是发生改变。
    19 条回复    2016-12-29 01:57:47 +08:00
    airyland
        1
    airyland  
       2016-12-28 00:30:28 +08:00
    这原生接口就能实现吧, npm 库也很多,比如 walk https://npm.taobao.org/package/walk
    HLT
        2
    HLT  
    OP
       2016-12-28 00:34:24 +08:00
    @airyland 呃 还有吗
    SoloCompany
        3
    SoloCompany  
       2016-12-28 01:34:37 +08:00
    airyland
        4
    airyland  
       2016-12-28 07:20:04 +08:00 via iPhone
    @HLT 自行 google
    araraloren
        5
    araraloren  
       2016-12-28 08:54:58 +08:00
    ~~ 这问的时间已经写完几个了吧
    Rice
        6
    Rice  
       2016-12-28 09:11:58 +08:00
    node 不是有 API 吗
    ferrum
        7
    ferrum  
       2016-12-28 10:03:03 +08:00 via iPhone
    node-directory-tree, complete-directory-tree on Github/npm
    tobeyouth
        8
    tobeyouth  
       2016-12-28 10:09:29 +08:00
    fs 直接就可以
    xylitolLin
        9
    xylitolLin  
       2016-12-28 10:59:21 +08:00
    你是说浏览器的 js 还是 node.js
    HLT
        10
    HLT  
    OP
       2016-12-28 15:30:43 +08:00
    @araraloren 哎,智商不够啊

    @Rice
    @ferrum
    @SoloCompany
    不会 nodejs 原谅我
    HLT
        11
    HLT  
    OP
       2016-12-28 15:31:20 +08:00
    @xylitolLin 浏览器
    xylitolLin
        12
    xylitolLin  
       2016-12-28 15:47:46 +08:00
    @HLT 除了 ie ,其他浏览器没有办法,不要想了,这是基于安全理由
    HLT
        13
    HLT  
    OP
       2016-12-28 16:12:25 +08:00
    @xylitolLin 嗯,在用 PHP 来解决了。。。
    SoloCompany
        14
    SoloCompany  
       2016-12-28 16:40:01 +08:00
    浏览器读文件,你是在逗我们?
    HLT
        15
    HLT  
    OP
       2016-12-28 17:06:29 +08:00
    @SoloCompany 你想多了。。。只是去获取目录下文件名称
    HLT
        16
    HLT  
    OP
       2016-12-28 17:08:35 +08:00
    @SoloCompany ![)_%QNLEF3ERR$[%M9_]B41I.jpg]( https://ooo.0o0.ooo/2016/12/28/586381037ef0d.jpg)
    lslqtz
        17
    lslqtz  
       2016-12-28 17:20:05 +08:00 via iPhone
    @HLT PHP 读文件,是服务端的?那 js 也可以,读本地 PHP 服务端也读不过来的
    Sparetire
        18
    Sparetire  
       2016-12-28 22:27:40 +08:00
    浏览器端,通过 File API 或许有可能实现,参考这篇 https://www.cnblogs.com/index-html/p/dialog-phishing.html
    LeoEatle
        19
    LeoEatle  
       2016-12-29 01:57:47 +08:00
    。。。__dirname?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2335 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 12:16 · PVG 20:16 · LAX 05:16 · JFK 08:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.