Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function binaryMd5(data, callback) {
var inputIsString = typeof data === 'string';
var len = inputIsString ? data.length : data.size;
var chunkSize = Math.min(MD5_CHUNK_SIZE, len);
var chunks = Math.ceil(len / chunkSize);
var currentChunk = 0;
var buffer = inputIsString ? new Md5() : new Md5.ArrayBuffer();
var append = inputIsString ? appendString : appendBlob;
function next() {
setImmediateShim(loadNextChunk);
}
function done() {
var raw = buffer.end(true);
var base64 = rawToBase64(raw);
callback(base64);
buffer.destroy();
}
function loadNextChunk() {
var start = currentChunk * chunkSize;