Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function appendBlob(buffer, blob, start, end, callback) {
if (start > 0 || end < blob.size) {
// only slice blob if we really need to
blob = sliceBlob(blob, start, end);
}
readAsArrayBuffer(blob, function (arrayBuffer) {
buffer.append(arrayBuffer);
callback();
});
}
err.code = 'ETIMEDOUT';
} else if (typeof xhr.response === 'string' && xhr.response !== '') {
try {
err = JSON.parse(xhr.response);
} catch (e) {}
}
err.status = xhr.status;
callback(err);
}
cleanUp();
};
if (options.body && (options.body instanceof Blob)) {
readAsArrayBuffer(options.body, function (arrayBuffer) {
xhr.send(arrayBuffer);
});
} else {
xhr.send(options.body);
}
return ret;
}