forked from external-repos/squoosh
Jake’s thoroughness is doing my head in :P
This commit is contained in:
@@ -26,7 +26,7 @@ export const decodersPromise: Promise<Decoder[]> = Promise.all(
|
||||
// values here.
|
||||
).then(list => list.filter(item => !!item)) as any as Promise<Decoder[]>;
|
||||
|
||||
export async function findDecodersByMimeType(mimeType: string): Promise<Decoder[]> {
|
||||
async function findDecodersByMimeType(mimeType: string): Promise<Decoder[]> {
|
||||
const decoders = await decodersPromise;
|
||||
return decoders.filter(decoder => decoder.canHandleMimeType(mimeType));
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ export async function sniffMimeType(blob: Blob): Promise<string> {
|
||||
Array.from(new Uint8Array(firstChunk))
|
||||
.map(v => String.fromCodePoint(v))
|
||||
.join('');
|
||||
for (const [detector, mimeType] of magicNumberToMimeType.entries()) {
|
||||
for (const [detector, mimeType] of magicNumberToMimeType) {
|
||||
if (detector.test(firstChunkString)) {
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user