app.WriteFile issue

243 views
Skip to first unread message

Julio Serrano

unread,
Nov 11, 2014, 9:29:14 PM11/11/14
to androi...@googlegroups.com
I'm trying to download a file. The file downloads OK, but app.WriteFile fails
its labour and writes only 133 bytes. It is a zip file, so I wonder if it fails
because it finds a binary character which is unable to handle.

Is this a bug? There is a binary mode? Please help me! :(

nelson zes

unread,
Nov 12, 2014, 4:07:27 AM11/12/14
to androi...@googlegroups.com
https://groups.google.com/forum/m/#!topic/androidscript/I7Wa69BkdRA

Im have the Same problem is the CHR 12 of ASCII table


Dave Smart

unread,
Nov 12, 2014, 5:46:19 AM11/12/14
to androi...@googlegroups.com
Hi Guys,

Sorry, there is currently no binary mode for the app.WriteFile function.  The only 'non-standard' mode supported is "ASCII" at the moment. 
I'll put it on the 'Todo' list.  :)

If you just need to save and load binary data, you could probably use the JavaScript btoa() an atob() functions to convert to base64.  But this won't help with saving zip files tho.

For downloading files (including zip files) direct to sdcard, you can use the app.CreateDownloader() method like this:-

:
dload = app.CreateDownloader();
dload.SetOnComplete( dload_OnComplete );
dload.Download( srcFileUrl, targetDir );
:

You can pass a comma seperated list of file urls to download.
You can use dload.IsComplete(), dload.GetProgress() and dload.GetSize() methods too.

Regards
David

Julio Serrano

unread,
Nov 12, 2014, 6:04:42 PM11/12/14
to androi...@googlegroups.com
That's nice.
Thanks Dave!

Thomas Kühne

unread,
Jan 8, 2015, 9:22:25 AM1/8/15
to androi...@googlegroups.com
Thanks too, that's a piece of information that rises the value of your project to me :-)

Is it possible
- to know whether download success or not? (for intance invalid URI odr invalid save path)
- to hide or customize the download progress indicator? (tested under Android 4.4.2 on Samsung) 

I have added you example to the wiki (because I'm convinced too that the wiki should become the most complete documentation of the project :-)

Greetings
Thomas
Reply all
Reply to author
Forward
Message has been deleted
0 new messages