How to use is-blob - 2 common examples

To help you get started, we’ve selected a few is-blob 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 fengyuanchen / compressorjs / src / index.js View on Github external
init() {
    const { file, options } = this;

    if (!isBlob(file)) {
      this.fail(new Error('The first argument must be a File or Blob object.'));
      return;
    }

    const mimeType = file.type;

    if (!isImageType(mimeType)) {
      this.fail(new Error('The first argument must be an image File or Blob object.'));
      return;
    }

    if (!URL || !FileReader) {
      this.fail(new Error('The current browser does not support image compression.'));
      return;
    }
github xkeshi / image-compressor / src / index.js View on Github external
return new Promise((resolve, reject) => {
      if (!isBlob(file)) {
        reject(new Error('The first argument must be a File or Blob object.'));
        return;
      }

      const mimeType = file.type;

      if (!isImageType(mimeType)) {
        reject(new Error('The first argument must be an image File or Blob object.'));
        return;
      }

      if (!URL && !FileReader) {
        reject(new Error('The current browser does not support image compression.'));
        return;
      }

is-blob

Check if a value is a `Blob`

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular is-blob functions