demo · v132

File System Access — live editor

Open a text file from disk, edit it, and save it back. Uses showOpenFilePicker() and createWritable(). Probes confirm support for each surface area.

showOpenFilePicker: —
showSaveFilePicker: —
showDirectoryPicker: —

the code

const [handle] = await window.showOpenFilePicker();
const file = await handle.getFile();
const text = await file.text();
const w = await handle.createWritable();
await w.write(text + "<changes>");
await w.close();

see also