Read/write simple output from Ruby's Marshal library.
This is not for you. First of all, don't use Marshal for that. And second of all, no smoking.
Now we're talking.
I've done basics like true, false and nil, Fixnums, Floats, strings that just contain ASCII/latin1 chars, arrays and hashes. Coverage of what can be serialized is far from exhaustive.
var marsha = ;
Marshaled data contains all sorts of nonprintable characters; you can provide it as a buffer:
var buffer = fs;marsha;
Or you can provide a string and an encoding, a buffer will be created internally.
marsha; // returns [ 1, 2, 3 ]
The JS representation of the marshaled data will be returned, or an exception will be thrown if it's not usable. Marshal can serialize a wide variety of Ruby objects including instances of builtin and user defined classes, which may not have a JS equivalent.
:symbols are treated as strings in JS land.
Writing is similar to reading, returns a buffer if called with one argument:
marsha; // returns <Buffer 04 08 5b 08 69 06 69 07 69 08>
or a string if called with two:
marsha; // returns 'BAhbCGkGaQdpCA=='
Most coverage is generated from
test/examples.json, which contains various hex-encoded outputs from asking Marshal to encode things in irb, and their JS equivalents.