mirror of
https://github.com/Stef-00012/Zipline-Android-App.git
synced 2025-05-11 18:35:58 +02:00
[nobuild] fix original name not working, partially finish full screen file display
This commit is contained in:
parent
604301fcbf
commit
2fcca6686e
16 changed files with 490 additions and 143 deletions
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue