IndexedDB: Store file as File or Blob or ArrayBuffer. What is the best option?

后端 未结 2 488
甜味超标
甜味超标 2021-02-02 11:03

Now most of browsers are supporting IndexedDB to store data/file directly as File, Blob or ArrayBuffer.

This code save

2条回答
  •  难免孤独
    2021-02-02 11:30

    I recommend using Blob for images & videos as the API is fairly straightforward for downloading as blob and saving to db, as well as retrieving from db and creating URL for src attribute

    Check this sample here for implementation https://hacks.mozilla.org/2012/02/storing-images-and-files-in-indexeddb/

提交回复
热议问题