Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 26
Registered: ‎03-06-2012
My Device: playbook
My Carrier: 8298611647

Javascript save to local directory

Im trying to unzip a file, using zip.js, i would like to know if there's a way to save the unzipped files to the playbook without user interaction.

 

What im receiving in each zip file is something  like this.

--- a.html

--- b.jpg

 

where in a.html will be a <img src="b.jpg" />

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Javascript save to local directory

A quick look at the zip.js demo page suggests it is using the blob file format

http://gildas-lormeau.github.com/zip.js/demos/demo2.html

 

Have you considered trying the blackberry.io.file.saveFile() method (would be for WebWorks applications only - not the browser)?

https://bdsc.webapps.blackberry.com/html5/apis/blackberry.io.file.html#.saveFile

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Regular Contributor
Posts: 81
Registered: ‎03-09-2012
My Device: PlayBook & Bold 9780
My Carrier: n/a

Re: Javascript save to local directory

Usually you'd put resources like images in their own folder: <img src='images/b.jpg' />

and extra .html pages can be put in the root folder of the project.

 

There's no real need to zip them, because the .bar and .cod file formats are in fact already a .zip files.

Or is this about resources fetched from remote servers?

Thought about packaging resource bundles for extra content?

New Developer
Posts: 26
Registered: ‎03-06-2012
My Device: playbook
My Carrier: 8298611647

Re: Javascript save to local directory

The data by example file.myextension wil be a zip file, so each time i open one of em i must unzip it, thats why they could'nt be into my .bar file
New Developer
Posts: 26
Registered: ‎03-06-2012
My Device: playbook
My Carrier: 8298611647

Re: Javascript save to local directory

Yes i was using the blackberry.io.file, but when I open a file, the blob is empty, no matter what kind of file tips I use.

Can you show me a working example maybe reading a Txt file?
New Developer
Posts: 26
Registered: ‎03-06-2012
My Device: playbook
My Carrier: 8298611647

Re: Javascript save to local directory

Here they said the stringtoBlob, and blobtoString are'nt working, so no matter what you are trying to, you can't manipulate data, any solution?

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/WebWorks-SDK-v2-1-0-and-File-API...

Regular Contributor
Posts: 81
Registered: ‎03-09-2012
My Device: PlayBook & Bold 9780
My Carrier: n/a

Re: Javascript save to local directory

> The data by example file.myextension wil be a zip file, so each time i open one of em i must unzip it,

> thats why they could'nt be into my .bar file

 

I still fail to see why you can't or don't want to put these resources (unzipped) in the .bar file. There's hardly any advantage in storage space and it takes more script code (which you already have problems with to get working)

 

New Developer
Posts: 26
Registered: ‎03-06-2012
My Device: playbook
My Carrier: 8298611647

Re: Javascript save to local directory

[ Edited ]

Because they are users files, the app should be just no more than editor.

 

Sorry the blackberry playbook autocorrelation is horrible