V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
bajie
V2EX  ›  程序员

JS 能实现本地文件的读写吗?

  •  
  •   bajie · Dec 6, 2018 · 3701 views
    This topic created in 2703 days ago, the information mentioned may be changed or developed.

    还要兼容所有浏览器 ie9+

    10 replies    2018-12-06 17:38:34 +08:00
    circleee
        1
    circleee  
       Dec 6, 2018
    浏览器不能
    beginor
        2
    beginor  
       Dec 6, 2018 via Android
    IE9 不能,https://caniuse.com/#feat=fileapi。

    如果一定要,自己写 com 组件。
    bajie
        3
    bajie  
    OP
       Dec 6, 2018
    @beginor fileapi 好像只能读 不能写
    1010543618
        4
    1010543618  
       Dec 6, 2018
    以前面试还问到过这题呢
    现在看来可以用 File API 读,然后 URL API 下载文件当做写。。
    1010543618
        5
    1010543618  
       Dec 6, 2018
    yiFire
        6
    yiFire  
       Dec 6, 2018
    imswing
        7
    imswing  
       Dec 6, 2018 via iPhone
    FileReader 只能读
    AV1
        8
    AV1  
       Dec 6, 2018 via Android
    读可以用 FileReader,写可以用<a download>
    wangsen1611
        9
    wangsen1611  
       Dec 6, 2018
    IE6 和 IE5.5 可以
    wangsen1611
        10
    wangsen1611  
       Dec 6, 2018
    IE6 和 IE5.5 别说读文件 关机都行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2164 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 00:51 · PVG 08:51 · LAX 17:51 · JFK 20:51
    ♥ Do have faith in what you're doing.