mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Uint8Array migration
This commit is contained in:
@@ -16,13 +16,10 @@ import {
|
||||
*
|
||||
* [0]: https://mimesniff.spec.whatwg.org/#matching-an-image-type-pattern
|
||||
*/
|
||||
export function sniffImageMimeType(
|
||||
bytes: ArrayBuffer | Uint8Array
|
||||
): undefined | MIMEType {
|
||||
const asTypedArray = new Uint8Array(bytes);
|
||||
export function sniffImageMimeType(bytes: Uint8Array): undefined | MIMEType {
|
||||
for (let i = 0; i < TYPES.length; i += 1) {
|
||||
const type = TYPES[i];
|
||||
if (matchesType(asTypedArray, type)) {
|
||||
if (matchesType(bytes, type)) {
|
||||
return type.mimeType;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user