Question

Folks:

I'm creating an app using Node Webkit. The purpose of this app is to display images and pdfs. The app needs to download those files from a central repository, and cache them locally. When the app runs offline, the files should still be available, and displayed.

On the face of it, this sounds like appcache is the answer - and that indeed is where I was heading when this was a pure webapp in a browser. However, now I've discovered node-webkit, and here we are.

node-webkit's GitHub wiki states: "However, application cache is designed for browser use, for apps using node-webkit, it's less useful than the other two method, read HTML5 Application Cache if you want to use it."

But doesn't say why.

I've also researched node.js filesystem - but that seems like a whole magnitude of complexity above what I need.

Can anyone point me in a sensible direction?

Thanks.

Was it helpful?

Solution

It has to do with the nature of App Cache itself.

You specify a manifest file that lists all the static assets required for your app to run offline. You don't have any programmatic access to the cache to add and remove files via JS.

So for a node-webkit app, it'd make more sense to fetch these files and store them in the Application Support folder (Or AppData, depending on the platform). That's where the node.js part is really useful, the file IO stuff.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top