10LOC

#files

Chrome APIsadvanced

The File System Access API for native file read/write

// TypeScript's DOM lib has FileSystemFileHandle but not window.showOpenFilePicker
// itself yet -- narrow cast for just the missing entry point.
type ShowOpenFilePicker = (opts: {
  types: { description: string; accept: Record<string, string[]> }[];
}) => Promise<FileSystemFileHandle[]>;

showOpenFilePicker and createWritable read and overwrite a real file on disk from the browser — Chromium only, no Firefox or Safari support.