Hacker News new | past | comments | ask | show | jobs | submit login

Sorry, it doesn't work on binary data:

    node> var buf = require('fs').readFileSync('./tests/data/data-png.png');
    node> require('jacob.js').base64.encode(buf)
    Base64CodecError: Input contains out-of-range characters.
Also node.js now has its own base64 encoding and decoding functions right in Buffer, so there is no longer need for any base64 modules.



Well okay, it's intended to work in the browser (note: this was also written before Node had any decent binary data type; I haven't really been keeping track, does it now?) and so "binary data" is just a string where each byte is the lower byte of one character. It could pretty easily be modified to take advantage of better data types in contexts where they are available (or if someone's using a string for "binary data" where two bytes of data are stored in each character, modified to deal with that).


No, it still does not!


I guess I should just go look (though I haven't been using Node for anything for about 8 months), but what does it do for binary data then? When you load a png file, what do you get?


Just char * to a memory block abstracted as the Buffer class.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: