Re:Show HN: Defrag the Game
by r1chardnl on Monday September 02, 2024 @07:41AM
(#41424564)
Just a matter of time before Chrome pushes another JS API like File System API and you can actually defrag your drive from the browser.
[ Parent
| on HN ]
Should already work today with your cloud storage I think
It's already there: https://developer.mozilla.org/en-US/docs/Web/API/File_System...
They say "like" this one because it only provides file level interaction, not disk level interaction.
Re:Show HN: Defrag the Game
by HeatrayEnjoyer on Monday September 02, 2024 @10:02AM
(#41425457)
Why do APIs like this even exist? There's no legitimate reason for an HTML webpage to need this, it's just creating more attack surface for bad actors.
The File System API is a JavaScript API, not an HTML one, so it helps to think about it from that light (programs, not documents). The API allows tools such as photo editors, file converters, code editors, and the like to be given access to a set of files they can work on directly rather than needing to import and export from the browser on every change. If the attack surface is too much for a use case it can be globally denied by default in every major browser so you won't even get prompted.
Re:Show HN: Defrag the Game
by HeatrayEnjoyer on Monday September 02, 2024 @01:25PM
(#41427201)
JavaScript is just a feature accessory for HTML. There's no meaningful difference.
For whatever your preference in slicing that up is you can carry the "programs, not documents" reasons along.
Re:Show HN: Defrag the Game
by HeatrayEnjoyer on Tuesday September 03, 2024 @08:35AM
(#41434352)
Right, but programs are programs. Browsers are for webpages. If we want a program we run an .exe
The page needs permission. That permission step is similar to the act of downloading a native app. Except for the fact that the broswer gives even less access to your system
than a native app so it's safer than a native app. (at least on desktop) That file system API is super useful for cloud based IDEs as just one example
Microsoft has an elaborate VS Code demo app that uses this API. Click "Open Folder" to see the API in action): https://vscode.dev
If you know the right identifiers, you should be able to use WebUSB to access a flash drive/external hard drive. Combined with C-to-WASM compilers and Linux driver code, I'm sure you can defragment from the browser alone.
Or you can hook this mechanism into one of the WASM x64 emulators and attach the drive directly to a copy of MS-DOS or Windows 98 running in the browser.