Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function normalizeBlob(body) {
var type = typeof body;
if (type === "string") {
return binary.fromRaw(body);
}
if (body && type === "object") {
if (body.constructor.name === "ArrayBuffer") body = new Uint8Array(body);
if (typeof body.length === "number") {
return body;//binary.toRaw(body);
}
}
throw new TypeError("Blob body must be raw string, ArrayBuffer or byte array");
}