mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 01:59:57 +00:00
Implement mime type sniffing
This commit is contained in:
@@ -2,7 +2,6 @@ import { blobToArrayBuffer, imageDataToBitmap } from '../../lib/util';
|
||||
import DecoderWorker from './Decoder.worker';
|
||||
|
||||
export const name = 'WASM WebP Decoder';
|
||||
export const supportedExtensions = ['webp'];
|
||||
export const supportedMimeTypes = ['image/webp'];
|
||||
export async function decode(file: File): Promise<ImageBitmap> {
|
||||
const decoder = await new DecoderWorker();
|
||||
@@ -13,3 +12,7 @@ export async function decode(file: File): Promise<ImageBitmap> {
|
||||
export async function isSupported(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function canHandleMimeType(mimeType: string): boolean {
|
||||
return supportedMimeTypes.includes(mimeType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user