Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
db.transaction(function (tx) {
var text;
try {
text = bodec.toBase64(deflate(buffer));
}
catch (err) {
return callback(err);
}
tx.executeSql(sql, [hash, text], function () {
callback(null, hash);
});
});
}
function encodeBlob(blob) {
if (typeof blob === "string") return {
content: bodec.encodeUtf8(blob),
encoding: "utf-8"
};
if (bodec.isBinary(blob)) return {
content: bodec.toBase64(blob),
encoding: "base64"
};
throw new TypeError("Invalid blob type, must be binary or string");
}
function encodeBlob(blob) {
if (typeof blob === "string") return {
content: binary.encodeUtf8(blob),
encoding: "utf-8"
};
if (binary.isBinary(blob)) return {
content: binary.toBase64(blob),
encoding: "base64"
};
throw new TypeError("Invalid blob type, must be binary of string");
}
function encodeBlob(blob) {
if (typeof blob === "string") return {
content: bodec.encodeUtf8(blob),
encoding: "utf-8"
};
if (bodec.isBinary(blob)) return {
content: bodec.toBase64(blob),
encoding: "base64"
};
throw new TypeError("Invalid blob type, must be binary or string");
}