Sheraff / soft-serve-tunes

Self hosted music server on raspberry pi
7 stars 0 forks source link

Investigate file system API #21

Open Sheraff opened 1 year ago

Sheraff commented 1 year ago

Maybe media files (+ images) might be more reliably stored in the navigator's private file system https://web.dev/file-system-access/

const root = await navigator.storage.getDirectory();
// Create a new file handle.
const fileHandle = await root.getFileHandle('Untitled.txt', { create: true });
// Create a new directory handle.
const dirHandle = await root.getDirectoryHandle('New Folder', { create: true });
// Recursively remove a directory.
await root.removeEntry('Old Stuff', { recursive: true });

I haven't had any problems so far with the service worker cache. This is just in case.