Titanium saves files from stream

I have a streamerserver (SOAP) with different types of files, and I see it in physical storage. I try this code, but I only create a file with my line.

api.getFile(function(fileString) {

        var original = 'Appcelerator';
        var decoded = Ti.Utils.base64decode(fileString);

        var Settings = Titanium.Filesystem.getFile(Titanium.Filesystem.tempDirectory, 'Settings');
        var newFile = Titanium.Filesystem.getFile(Settings.nativePath, 'Settings.pdf');
        newFile.createFile(decoded);
      // Ti.API.info('newfile: '+newFile.read());    
    }); 
}
}
+4
source share
1 answer

try this one.

 var original = 'Appcelerator';
 var decoded = Ti.Utils.base64decode(fileString);

 var Settings = Titanium.Filesystem.getFile(Titanium.Filesystem.tempDirectory, 'Settings');
 Settings.createDirectory();
 var newFile = Titanium.Filesystem.getFile(Settings.nativePath, 'Settings.pdf');
 newFile.write(decoded);
+1
source

All Articles