缓存对本地文件的引用

Cache reference to local files

我正在试验 Filereader API 和 Webaudio API,并且正在构建一个基本的音频播放器,用户可以在其中上传 mp3 并播放它们等。

如果用户上传的文件能够保留,那就太好了,这样如果他们刷新页面或导航离开,就不需要重新上传文件。

这是否可以不将文件上传到服务器?

感谢任何帮助!

是的。你可以使用 IndexedDB for that purpose. You can store blob data using it. However, you should notice that support in Safari is buggy - this means there are some quirks that may result in serious issues with your app for users that use this browser. If you need to get things done quickly, I suggest you to use either localForage or IDBWrapper with this shim.