home libs

libs / js / io / file-server / file-server.js

19 Dec 2025

This library interfaces the server to expose direct file system operations to the browser through a simple fetch‑based API. By sending requests such as

the library requires nodejs to be installed

var fs = await import(); fs.url = 'localhost'; fs.port = 3000; fs.auth = 'my-auth'; var {blob,error} = await fs.file.load('a.txt'); if(error){ console.error(error); return; } var txt = await blob.text(); console.log(txt);

the browser can interact with local files securely and consistently.

Supported operations include:

load → retrieve file contents

save → write or overwrite file data

file delete → remove a file

dir read → list directory contents

dir create → make a new directory

dir delete → remove a directory

Together, these commands provide a complete set of standard file I/O capabilities accessible from the browser. This member sits at the Code stage of the pipeline: more substantial than a library, since it defines a working server with a defined protocol, but not yet a full project. It serves as a foundation for building browser‑driven file management tools, developer utilities, or experimental web‑native applications.