buffer.toString with base64 encoding fails for any buffer larger than or equal to 201326581 bytes (~192 MB).
See the following piece of code:
var buf1 = new Buffer(201326580), //biggest buffer that works
buf2 = new Buffer(201326581); //~192 MB
buf1.toString('base64'); //works
buf2.toString('base64'); //fails!
For older node versions (like v0.12.2) this cause the process to crash with this error:
#
# Fatal error in d:\jenkins\workspace\nodejs-msi-julien\d8c2e2bb\deps\v8\src/handles.h, line 48
# CHECK(location_ != NULL) failed
#
Segmentation fault
For newer versions (like v5.2.0), it gives the following error:
buffer.js:401
throw new Error('toString failed');
^