mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
15 lines
448 B
TypeScript
15 lines
448 B
TypeScript
import { getAllFileInfos } from "$lib/indexedDB";
|
|
|
|
export const requestFreshMediaFilesRetrieval = async (limit = 8) => {
|
|
const files = await getAllFileInfos();
|
|
files.sort(
|
|
(a, b) =>
|
|
(b.createdAt ?? b.lastModifiedAt).getTime() - (a.createdAt ?? a.lastModifiedAt).getTime(),
|
|
);
|
|
return files
|
|
.filter(
|
|
({ contentType }) => contentType.startsWith("image/") || contentType.startsWith("video/"),
|
|
)
|
|
.slice(0, limit);
|
|
};
|