HTML5 & Web APIs (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
File System Access API (`showOpenFilePicker`): Direct File Operations.
senior LevelCode ExampleSystem DesignHTTP & REST APIs
In Simple Words:
Replaces legacy <input type="file"> by allowing web applications to read, edit, and save files directly to the user's local operating system:
javascript
// Opens native OS file picker
const [fileHandle] = await window.showOpenFilePicker({
types: [{ description: 'Text Files', accept: { 'text/plain': ['.txt'] } }]
});
// Read contents
const file = await fileHandle.getFile();
const contents = await file.text();
// Save modifications back to the exact same file!
const writable = await fileHandle.createWritable();
await writable.write('Updated content');
await writable.close();