How to add some images to local cache?

49 views
Skip to first unread message

VoidVolker

unread,
Dec 24, 2013, 6:04:54 AM12/24/13
to node-...@googlegroups.com
I have 5k/1Gb of images in Internet server. Client app PC have slow internet connection. I want to cache all this images at start and some other 7-15k small images in runtime. What is the simple way to do this? I tried to use node.js http.get(url) - but it's not very comfortable.

App: kiosk. OS: win7. Kiosk Internet: from 100kbit/s to 5 mbit/s.

Laszlo Z. Antal

unread,
Dec 24, 2013, 10:38:39 AM12/24/13
to node-...@googlegroups.com, node-...@googlegroups.com
Hi,

On Dec 24, 2013, at 3:04 AM, VoidVolker <voidv...@gmail.com> wrote:

I have 5k/1Gb of images in Internet server. Client app PC have slow internet connection. I want to cache all this images at start and some other 7-15k small images in runtime. What is the simple way to do this? I tried to use node.js http.get(url) - but it's not very comfortable.

App: kiosk. OS: win7. Kiosk Internet: from 100kbit/s to 5 mbit/s.

Well browsers in general store a cache for all loaded images and use the cache if you request them again with the same url. So if that holds true with node-webkit(I haven't tested it) then you can just make a bunch of ajax requests to handle the creation of the cache. 

Laszlo
http://twitter.com/LZAntal

--
You received this message because you are subscribed to the Google Groups "node-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-webkit...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

VoidVolker

unread,
Dec 24, 2013, 11:05:32 AM12/24/13
to node-...@googlegroups.com
I tried it already: after deleting container with images nw is clearing cache with this images. Loading images via js doesn't load them in cache.

nana...@gmail.com

unread,
Jan 10, 2015, 3:11:22 AM1/10/15
to node-...@googlegroups.com
Have the same issue on MacOS App. Any solution to this?

VoidVolker

unread,
Jan 10, 2015, 3:34:09 AM1/10/15
to node-...@googlegroups.com, nana...@gmail.com

Have the same issue on MacOS App. Any solution to this?

I'm write my own cache system. Logic is simple:
  1. Use special function in source code for images
  2. It search image in cache and return local path.
  3. If it not in local cache - it loads image from given url to local disk and return local path.
When application starts, it load catalogue with items and I call this function for each items picture. And do the same when update local catalogue. In my case there are >10k images @ >1,5Gb.
If image loads with error - it replace special error image "Sorry! Image not found".
Reply all
Reply to author
Forward
0 new messages