How to use the bodec.toBase64 function in bodec

To help you get started, we’ve selected a few bodec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github es-git / es-git / mixins / websql-db.js View on Github external
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);
    });
  });
}
github digidem / react-mapfilter / app / js / lib / backbone-github.js View on Github external
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");
}
github es-git / es-git / mixins / github-db.js View on Github external
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");
}
github creationix / js-github / mixins / github-db.js View on Github external
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");
}