I have pretty hard task to solve, so i am building face recognition and face detection needs HTMLImageElement as argument, but problem is that i can not install node-canvas to polyfill it so i need another way to change file sent from client to HTMLImageElement, is there any way to do it? and also to polyfill canvas. here is my code
const imgBuffer = await sharp(path.resolve(__dirname, '..', 'queryImages', file.filename))/*.toBuffer()*/;
//const imgTensor = faceapi.tf.tensor3d(new Uint8Array(imgBuffer), [480,640,3]);
const detections = await faceapi.detectAllFaces(imgBuffer);
and error
(node:3620) UnhandledPromiseRejectionWarning: Error: toNetInput - expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id