michael@0: /** michael@0: * Expects an object containing a blob, a start offset, an end offset michael@0: * and an optional content type to slice the blob. Returns an object michael@0: * containing the size and type of the sliced blob. michael@0: */ michael@0: onmessage = function(event) { michael@0: var blob = event.data.blob; michael@0: var start = event.data.start; michael@0: var end = event.data.end; michael@0: var contentType = event.data.contentType; michael@0: michael@0: var slicedBlob; michael@0: if (contentType == undefined && end == undefined) { michael@0: slicedBlob = blob.slice(start); michael@0: } else if (contentType == undefined) { michael@0: slicedBlob = blob.slice(start, end); michael@0: } else { michael@0: slicedBlob = blob.slice(start, end, contentType); michael@0: } michael@0: michael@0: var rtnObj = new Object(); michael@0: michael@0: rtnObj.size = slicedBlob.size; michael@0: rtnObj.type = slicedBlob.type; michael@0: michael@0: postMessage(rtnObj); michael@0: };