alexcorvi / heic2any

Converting HEIF/HEIF image formats to PNG/GIF/JPEG in the browser
https://alexcorvi.github.io/heic2any/
MIT License
585 stars 74 forks source link

react native; ERROR ReferenceError: Property 'Worker' doesn't exist, js engine: hermes #47

Closed hungtooc closed 1 year ago

hungtooc commented 1 year ago

I having this issue while running this code:

const a = fetch(pickerResult.fileCopyUri)
          .then(res => res.blob())
          .then(blob => {
            console.info(blob);
            return heic2any({
              blob,
              toType: 'image/jpeg',
              quality: 0.5, // cuts the quality and size by half
            });
          })
          .then(conversionResult => {
           // conversionResult is a BLOB
           // of the JPEG formatted image
           // with low quality
           })
          .catch(e => {
            console.error('Error at onPressStart()', e);
            // see error handling section
          });

console log:

 ERROR  ReferenceError: Property 'Worker' doesn't exist, js engine: hermes

at file heic2any.js (23:33)

alexcorvi commented 1 year ago

The library requires a full browser environment with DOM api to work.