You are confusing the server and the client. The browser has no programmatic access to the filesystem. Period. The filesystem api is triggered only via user interaction (like dragging and dropping a file on the webpage). You cannot write a file locally on the client.