nolanlawson / blob-util

Cross-browser utils for working with binary Blobs
https://nolanlawson.github.io/blob-util
Apache License 2.0
503 stars 45 forks source link

can not find name 'blobUtil' #52

Closed binita12345 closed 6 years ago

binita12345 commented 6 years ago

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

nolanlawson commented 6 years ago

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!

binita12345 commented 6 years ago

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

nolanlawson commented 5 years ago

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