V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
PageSpeed 相关文档
为 NGINX 编译 PageSpeed 支持
ngx_pagespeed
Configuring mod_pagespeed Filters
加载性能测试工具
WebPagetest
Gomez
Yesr00

面试的时候遇到一个奇葩需求,向大佬们取经。

  •  
  •   Yesr00 · Feb 24, 2025 · 2116 views
    This topic created in 427 days ago, the information mentioned may be changed or developed.

    RT,面试的时候遇到一个问题,大文件( 1G 起步)上传+断点续传,面试官要求把每个分片内容都存在缓存里,然后还要浏览器不会卡,并且避免溢出。 我查了一下 localstorage 存不了这么大的东西。有说 indexdb 的,但是面试官的要求是整个文件的所有分片都要存在缓存里。

    7 replies    2025-04-09 20:10:10 +08:00
    tf2
        1
    tf2  
       Feb 24, 2025
    浏览器写 js 的话,blob 就行吧?
    Daotin
        2
    Daotin  
       Feb 24, 2025
    indexeddb 可以存储整个文件的所有分片,或者使用 service worker 存储
    Razio
        3
    Razio  
       Feb 24, 2025
    存储的最多也就是文件分片的 hash,通过 hash 判断是否上传过。非要塞缓存的话,就先分片全塞 indexdb ,只去取当前需要上传的分片
    murmur
        4
    murmur  
       Feb 24, 2025
    大文件下载都要求下载网盘客户端,上传还 1g 起步,他再想屁吃
    neel
        5
    neel  
       Feb 24, 2025
    存在页面里
    aikilan
        6
    aikilan  
       Feb 24, 2025
    indexdb 没啥问题,但是确实没必要,如果是 PC 端计算切片 hash 就行
    NakanoAzure
        7
    NakanoAzure  
       Apr 9, 2025
    localstorage 存分片的哈希不就好了吗,为什么要存分片的内容呢。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3203 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 13:41 · PVG 21:41 · LAX 06:41 · JFK 09:41
    ♥ Do have faith in what you're doing.