简体   繁体   English

有没有一种方法可以将通过http直接下载的图像直接加载到内存中?

[英]Is there a way to load download an image over http directly to the memory?

Usually when someone clicks on an http link for a jpg file, that file gets downloaded into the user's browser cache from where it is loaded into memory. 通常,当有人单击jpg文件的http链接时,该文件将从加载到内存的位置下载到用户的浏览器缓存中。 Is there a way to avoid downloading the image to hard disk and just load it directly to the RAM? 有没有一种方法可以避免将映像下载到硬盘上,而直接将其加载到RAM中?

Update: What if you were writing a Windows forms application that fetches images over http. 更新:如果您正在编写Windows表单应用程序,该应用程序通过http获取图像,该怎么办? Is it possible then? 那有可能吗? If yes how? 如果是,怎么办?

This not related to anything I am trying to do. 这与我尝试执行的操作无关。 I am just curious that's all. 我很好奇,仅此而已。

It is the browser behaviour you cannot control. 这是您无法控制的浏览器行为。

So if you want that - you need to implement your own browser that does that and ask your users to use it. 因此,如果您愿意-您需要实现自己的浏览器,并要求您的用户使用它。

Answering your only question asked: 回答您提出的唯一问题:

Is there a way to avoid downloading the image to hard disk and just load it directly to the RAM? 有没有一种方法可以避免将映像下载到硬盘上,而直接将其加载到RAM中?

There is no way to tell browser how to process a request exactly. 无法告诉浏览器如何准确处理请求。

Update: What if you were writing a Windows forms application that fetches images over http. 更新:如果您正在编写Windows表单应用程序,该应用程序通过http获取图像,该怎么办? Is it possible then? 那有可能吗? If yes how? 如果是,怎么办?

It is already addressed by the first part of my answer. 我的答案的第一部分已经解决了这一问题。 Again: if it's you who implements an HTTP client/browser - then you're free to do whatever you want. 再次:如果是实施HTTP客户端/浏览器的人-那么您可以自由地做任何您想做的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM