[nobuild] fix original name not working, partially finish full screen file display

This commit is contained in:
Stef-00012 2025-02-03 20:26:00 +01:00
parent 604301fcbf
commit 2fcca6686e
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
16 changed files with 490 additions and 143 deletions

View file

@ -1,5 +1,7 @@
import mimetypesJSON from "@/assets/mimetypes.json";
import type { Mimetypes } from "@/types/mimetypes";
import bytes from "bytes";
import ms, { type FormatOptions } from "enhanced-ms";
import * as FileSystem from "expo-file-system";
const mimetypes = mimetypesJSON as Mimetypes;
@ -96,4 +98,26 @@ export function colorHash(str: string) {
}
return color;
}
export function convertToBytes(value: string | number, options?: bytes.BytesOptions): string | null {
if (typeof value === "number") return bytes(value, options);
if (/^\d+(\.\d+)?$/.test(value)) {
return bytes(Number.parseFloat(value),options);
}
return value;
}
export function convertToTime(value: string | number, options?: FormatOptions): string | null {
if (typeof value === "number") return ms(value);
if (/^\d+(\.\d+)?$/.test(value)) {
return ms(Number.parseFloat(value), options);
}
return value;
}