node.js - 有没有办法在客户端计算机中永久缓存文件?

标签 node.js http caching vue.js clientcache

我有一个网络应用程序,它提供扫描的旧文档的图像及其成绩单,其中有很多图像,大约 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/

相关文章:

javascript - 不要在 Blogger 中缓存图像

java - @Cachable 在没有输入参数的方法上?

javascript - 以 HTTPS 方式提供 Apostrope-CMS S3 Assets 和附件

node.js - 无法链接可执行文件 "node"- npm 在 termux 中运行时出错

java - 如何在 Java 中使用 Vert.X 运行 CPU 密集型并行任务

http - 是否有任何理由使用 HTTP 410 GONE 状态代码?

javascript - 如何在 react Bootstrap 表中添加按钮?

java - 优化 Android 中的 HttpURLConnection

javascript - 请求 Headers.append 不工作

memory - 将数据存储在内存中 : Session vs Cache vs Static