我有一个网络应用程序,它提供扫描的旧文档的图像及其成绩单,其中有很多图像,大约 5 GB,客户需要定期浏览它们。
我需要一个解决方案来在客户端缓存图像,因为图像是不可变的,它们应该只从服务器获取一次。
最佳答案
这将允许您在客户端计算机上缓存大量 GB。我看不出这将如何长期有效(用户清除缓存、更改浏览器、计算机等)。这听起来像是一个糟糕的问题解决方案。
话虽这么说,你应该看看IndexedDB :
IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.
注意事项:
- This feature is available in Web Workers.
- IndexedDB API is powerful, but may seem too complicated for simple cases. If you'd prefer a simple API, try libraries such as localForage, dexie.js, ZangoDB, PouchDB, and JsStore that make IndexedDB more programmer-friendly.
关于node.js - 有没有办法在客户端计算机中永久缓存文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54307260/