Saving files
nicoX

I am using Wade 1.1 to generate some data (some Json data that I need for my game). This works, but I don't know how to save this data... is it possible to save data with Wade to a local file?

 

(Now I'm outputting all my data to the console, then I do copy/paste into notepad, then save)

All 3 Comments
Shri

Nico

 

To the best of my knowledge,  javascript does not allow local file access for security reasons.

 

That said, you can write and read into the browser cache with wade using

wade.storeLocalObject() and wade.retrieveLocalObject()

 

If you wrote a series of objects you could then open your browse cache and cut and paste in one chunk rather than line by line

 

Check out this link for background html5 storage info "http://diveintohtml5.info/storage.html"

 

cheers,

Gio

That's right. Depending on which browser you are using, you can also create blobs (see here).

 

Here we use WADE as an image processing tool, among other things. You know how you sometimes have to do the same operation on lots of different sprites - for me the easiest way is to just write a small WADE app that does whatever operation I need to do with my sprites (resizing, adjusting colors, rotating, cropping), and then I save them all together in a zip file (using JSZip). Then, from my app, I initiate the download of the zip file (there is an example in the JSZip documentation).

 

This is possibly the easiest way to download a bunch of files that you have generated in JavaScript.

 

Incidentally, this way of doing image processing is much faster than doing the same thing with Photoshop, and you have a lot more control. I'm thinking of writing an image processing plug-in for WADE at some point to do this sort of things.

nicoX
Thank you both, I suspected there was a better way than copying and pasting!
Post a reply
Add Attachment
Submit Reply
Login to Reply