How to use the binary.fromRaw function in binary

To help you get started, we’ve selected a few binary 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 creationix / tedit / src / encoders.js View on Github external
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");
  }