• 请不要在回答技术问题时复制粘贴 AI 生成的内容
bajie
V2EX  ›  程序员

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

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

    还要兼容所有浏览器 ie9+

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

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