Use the implementation instead of the accidental infinite loop
This commit is contained in:
parent
e7e8ded1ed
commit
e0cfa36f08
2 changed files with 17 additions and 16 deletions
|
@ -1,15 +0,0 @@
|
|||
import HeicConvert from "heic-convert";
|
||||
import { getUint8ArrayView } from "services/readerService";
|
||||
|
||||
/**
|
||||
* Convert a HEIC file to a JPEG file.
|
||||
*
|
||||
* Both the input and output are blobs.
|
||||
*/
|
||||
export const convertHEICToJPEG = async (heicBlob: Blob): Promise<Blob> => {
|
||||
const filedata = await getUint8ArrayView(heicBlob);
|
||||
const result = await HeicConvert({ buffer: filedata, format: "JPEG" });
|
||||
const convertedFileData = new Uint8Array(result);
|
||||
const convertedFileBlob = new Blob([convertedFileData]);
|
||||
return convertedFileBlob;
|
||||
};
|
|
@ -1,9 +1,25 @@
|
|||
import * as Comlink from "comlink";
|
||||
import HeicConvert from "heic-convert";
|
||||
import { getUint8ArrayView } from "services/readerService";
|
||||
|
||||
export class DedicatedConvertWorker {
|
||||
async convertHEICToJPEG(fileBlob: Blob) {
|
||||
return this.convertHEICToJPEG(fileBlob);
|
||||
return convertHEICToJPEG(fileBlob);
|
||||
}
|
||||
}
|
||||
|
||||
Comlink.expose(DedicatedConvertWorker, self);
|
||||
|
||||
/**
|
||||
* Convert a HEIC file to a JPEG file.
|
||||
*
|
||||
* Both the input and output are blobs.
|
||||
*/
|
||||
export const convertHEICToJPEG = async (heicBlob: Blob): Promise<Blob> => {
|
||||
console.log("test")
|
||||
const filedata = await getUint8ArrayView(heicBlob);
|
||||
const result = await HeicConvert({ buffer: filedata, format: "JPEG" });
|
||||
const convertedFileData = new Uint8Array(result);
|
||||
const convertedFileBlob = new Blob([convertedFileData]);
|
||||
return convertedFileBlob;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue