serialize = function(obj, callback) {
            var subarray = [],
                unit = 1,
                header_size = TYPE_LENGTH + BYTES_LENGTH,
                type, byte_length = 0,
                length = 0,
                value = obj;

            type = find_type(obj);

            unit = Length[type] === undefined || Length[type] === null ? 0 :
                root[Length[type] + 'Array'].BYTES_PER_ELEMENT;

            switch (type) {
                case Types.UNDEFINED:
                case Types.NULL:
                    break;

                case Types.NUMBER:
                case Types.BOOLEAN:
                    byte_length = unit;
                    break;

                case Types.STRING:
                    length = obj.length;
                    byte_length += length * unit;
                    break;

                case Types.INT8ARRAY:
                case Types.INT16ARRAY:
                case Types.INT32ARRAY:
                case Types.UINT8ARRAY:
                case Types.UINT16ARRAY:
                case Types.UINT32ARRAY:
                case Types.FLOAT32ARRAY:
                case Types.FLOAT64ARRAY:
                    length = obj.length;
                    byte_length += length * unit;
                    break;

                case Types.ARRAY:
                    deferredSerialize(obj, function(subarray, byte_length) {
                        callback([{
                            type: type,
                            length: obj.length,
                            header_size: header_size + LENGTH_LENGTH,
                            byte_length: byte_length,
                            value: null
                        }].concat(subarray));
                    });
                    return;

                case Types.OBJECT:
                    var deferred = [];
                    for (var key in obj) {
                        if (obj.hasOwnProperty(key)) {
                            deferred.push(key);
                            deferred.push(obj[key]);
                            length++;
                        }
                    }
                    deferredSerialize(deferred, function(subarray, byte_length) {
                        callback([{
                            type: type,
                            length: length,
                            header_size: header_size + LENGTH_LENGTH,
                            byte_length: byte_length,
                            value: null
                        }].concat(subarray));
                    });
                    return;

                case Types.ARRAYBUFFER:
                    byte_length += obj.byteLength;
                    break;

                case Types.BLOB:
                    var mime_type = obj.type;
                    var reader = new FileReader();
                    reader.onload = function(e) {
                        deferredSerialize([mime_type, e.target.result], function(subarray, byte_length) {
                            callback([{
                                type: type,
                                length: length,
                                header_size: header_size,
                                byte_length: byte_length,
                                value: null
                            }].concat(subarray));
                        });
                    };
                    reader.onerror = function(e) {
                        throw 'FileReader Error: ' + e;
                    };
                    reader.readAsArrayBuffer(obj);
                    return;

                case Types.BUFFER:
                    byte_length += obj.length;
                    break;

                default:
                    throw 'TypeError: Type "' + obj.constructor.name + '" not supported.';
            }

            callback([{
                type: type,
                length: length,
                header_size: header_size,
                byte_length: byte_length,
                value: value
            }].concat(subarray));
        }
Serializes object and return byte_length
@param  {mixed} obj JavaScript object you want to serialize
@return {Array} Serialized array object