amfUtils.js
function amf0encXmlDoc(str) { // Essentially it is the same as string
    var buf = new Buffer(3);
    buf.writeUInt8(0x0F, 0);
    buf.writeUInt16BE(str.length, 1);
    return Buffer.concat([buf, new Buffer(str, 'utf8')]);
}
function amf0encXmlDoc(str) { // Essentially it is the same as string
    var buf = new Buffer(3);
    buf.writeUInt8(0x0F, 0);
    buf.writeUInt16BE(str.length, 1);
    return Buffer.concat([buf, new Buffer(str, 'utf8')]);
}
function amf0encXmlDoc ( str ) { // Essentially it is the same as string var buf = new Buffer ( 3 ) ; buf . writeUInt8 ( 0x0F , 0 ) ; buf . writeUInt16BE ( str . length , 1 ) ; return Buffer . concat ( [ buf , new Buffer ( str , 'utf8' ) ] ) ; }
AMF0 Encode XMLDoc
@param str
@returns {Buffer}
AMF0 Encode XMLDoc