Buffer.byteLength = function(str, enc) { var ret; str = str + ''; switch (enc) { case 'ascii': case 'binary': case 'raw': ret = str.length; break; case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': ret = str.length * 2; break; case 'hex': ret = str.length >>> 1; break; default: ret = internal.byteLength(str, enc); } return ret; };