Ricki Ricardo
Posts: 0
Joined: Fri Nov 16, 2012 9:30 am

Binary content save

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Binary content save

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

Ricki Ricardo
Posts: 0
Joined: Fri Nov 16, 2012 9:30 am

Binary content save

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

Return to “Issues”