Re: Saving binary from base64 with File classã By: Nightfox to All on Sat Sep 19 2015 08:31 pmãã > Hi all,ã >ã > I was looking at the Synchronet JavaScript API documentation for the Fileã > class:ã >
http://www.synchro.net/docs/jsobjs.html#Fileã > It says the File class has support for binary files and automatic Base64ã > decoding (among other features). It sounds to me like if I have someã > Base64-encoded data, I should be able to write that to a file using the Fileã > class and it will automatically decode it to binary format. I've triedã > opening a file with the mode "wb" (write binary) and using the write()ã > method to write the Base64-encoded data. It's not decoding the data toã > binary though - it's just writing the Base64 string to the file. Might I beã > missing a step to get it to convert Base64 data to binary?ã >ã > Basically my flow is this:ã >ã > var B64Data = "some Base64-encoded data";ã > var destFile = new File("someFile.bin");ã > if (destFile.open("wb"))ã > {ã > destFile.write(B64Data);ã > destFile.close();ã > }ããSet destFile.base64=true, other than that, looks right.ãã digital manããSynchronet "Real Fact" #84:ãThe ZMODEM file transfer protocol is limited to files of 4 gigabytes or smaller.ãNorco, CA WX: 75.9øF, 62.0% humidity, 0 mph SSE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã