nolanlawson/blob-util

can not find name 'blobUtil'

binita12345 opened this issue · 3 comments

when i use this node modules to convert my image in blob, i getting error "can not find module 'blobUtil'".

  1. I have installed "npm i blob-util" module
  2. import { canvasToBlob } from 'blob-util' , when i use to convert in blob in my app.
  3. my code is:
    blobUtil.imgSrcToBlob(res.json().data.productImage).then(function (blob) {
    // success
    }).catch(function (err) {
    // error
    });

How to solve this error or how to install or use modules in ionic 3 app.
please reply asap

When you import using the ESM module format:

import { canvasToBlob } from 'blob-util'

Then you omit the blobUtil part when you call it. It's only when you include it as a script tag that it creates a global blobUtil object. Hope that helps!

Property 'imgSrcToDataURL' does not exist on type '{}'.

It sounds like the library wasn't imported properly. Sorry I can't help you more than that...