UNPKG

@vladmandic/face-api

Version:

JavaScript module for Face Detection and Face Recognition Using Tensorflow/JS

11 lines 466 B
import { bufferToImage } from './bufferToImage'; import { fetchOrThrow } from './fetchOrThrow'; export async function fetchImage(uri) { const res = await fetchOrThrow(uri); const blob = await (res).blob(); if (!blob.type.startsWith('image/')) { throw new Error(`fetchImage - expected blob type to be of type image/*, instead have: ${blob.type}, for url: ${res.url}`); } return bufferToImage(blob); } //# sourceMappingURL=fetchImage.js.map