io/io-utils/makeBlob.js

  1. const nodeBlob = require('./Blob.js')
  2. /**
  3. * Make a constructor for Blob objects.
  4. * @return {Function} constructor of Blob objects
  5. * @alias module:io/utils.makeBlob
  6. * @example
  7. * const Blob = makeBlob()
  8. * const ablob = new Blob(data, { type: mimeType })
  9. */
  10. const makeBlob = () => {
  11. const blob = typeof window !== 'undefined' ? window.Blob : nodeBlob
  12. return blob
  13. }
  14. module.exports = makeBlob