• Saving binary from base64 with File class

    From Nightfox@VERT/DIGDIST to All on Sat Sep 19 20:31:30 2015
    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();ã}ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Sat Sep 19 23:48:42 2015
    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ã
  • From Nightfox@VERT/DIGDIST to Digital Man on Sun Sep 20 08:45:37 2015
    Re: Saving binary from base64 with File classã By: Digital Man to Nightfox on Sat Sep 19 2015 23:48:42ãã DM> Set destFile.base64=true, other than that, looks right.ããAh, I hadn't noticed that in the docs. Thanks.ããNightfoxãã---ã þ Synchronet þ Digital Distortion: digitaldistortionbbs.comã