gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-30 22:24:45 26 4
gpt4 key购买 nike

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com