Page 1 of 1

Binary content save

Posted: Fri May 03, 2013 1:41 pm
by Ricki Ricardo

Hello. In my application I use box.com api. This api provide posibility to recieve content of file. I want to save this content. If I recieve non-binary file like js, css, txt etc. I save file successfuly. But If I want to save binary file like png or jpg I have a problem.

Content is different. I seem it depenps on encoding. But I can't find solution how I can decedto to right direction.

1) This is my code to save data
var fileName = Tiggr('fileName').text(),
gotFS = function(fileSystem) {
alert('File ' + fileName + ' recieved.');
fileSystem.root.getFile(fileName, {create: true, exclusive: false}, gotFileEntry, fail);
},
gotFileEntry = function(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
},
gotFileWriter = function(writer) {
writer.write(jqXHR.responseText);
},
fail = function(error) {
alert('Error of getting access for FILE SYSTEM. Code ', error.code);
};

console.log('jqXHR = ', jqXHR);

if ((jqXHR) && (jqXHR.responseText)) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}

2) I cant use file transfer because I can recieve only content of file, nont file or url of file.


Binary content save

Posted: Fri May 03, 2013 5:45 pm
by maxkatz

You might want to check if Box has an example saving a binary file from their service.


Binary content save

Posted: Mon May 06, 2013 7:17 am
by Ricki Ricardo

I checked, but in document haven't information about binary download. Thanks. I'll ask on box.com support about this feature.