Jsb and the web

@pandamicro, @drelaptop,
I am using some jsb functions in my cocos creator project like jsb.saveimagedata and jsb.fileutils.xyz. it runs fine in the simulator but when I run it on the web I get the error :

can’t find variable jsb

is jsb not defined for the web?
for instance I am saving image data to the writable path…does that make sense in the web context? also, after saving the file I am checking if the file exists using jsb.fileUtils.isFileExist. will this work in a web build?

my requirement is basically that I want to save an image file on the device and then fetch image data from it when needed. please help with an example for the web build.


jsb is only available for native platforms.
you need to use alternative approach for web platform.

could you please provide an example or point to one , of saving images to files and other file operations, for the web platform.
thanks in advance!

Saving File on Web is same as Download.
So try Googling “Download File in JavaScript”.

You cannot just read/write files from a Browser without user involvement/action. But, if you must have this feature, there are ways. Eg: encode Binary to Base64 and save to/load from LocalStorage.