- Notifications
You must be signed in to change notification settings - Fork0
@browserfs VFS Adapter for OS.js
License
saoirse-iontach/osjs-browserfs-adapter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a BrowserFS VFS Adapter for OS.js.
OS.jsis anopen-sourceweb desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.
@BrowserFSis an in-browser file system that emulates theNode JS file system APIand supports storing and retrieving files from various backends.BrowserFS also integrates nicely with other tools.
Note
@ZenFS is an (breaking) update ofBrowserFS,with anode:fs interface.
@BrowserFS istransient project(fromBrowserFS towards@ZenFS).
@BrowserFS-iontach is a bugfixed fork of@BrowserFS @1.0.
Project | author | timeline | links |
---|---|---|---|
BrowserFS | John Vilk | 2014 - 2017 | npmgithub |
@BrowserFS | dr-Vortex | 09/2023 - 03/2024 | npmgithub |
@ZenFS | dr-Vortex | 03/2024 - ... | npmgithub |
Important
Next version probably move back to originaljVilk BrowserFS
BrowserFS is a component of theDoppio andBrowsix research projects from the PLASMA lab at the University of Massachusetts Amherst. If you decide to use BrowserFS in a project that leads to a publication, please cite the academic papers onDoppio andBrowsix.
citations
John Vilk and Emery D. Berger. Doppio: Breaking the Browser Language Barrier. InProceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation(2014), pp. 508–518.
references
@inproceedings{VilkDoppio,author={John Vilk and Emery D. Berger},title={{Doppio: Breaking the Browser Language Barrier}},booktitle={Proceedings of the 35th {ACM} {SIGPLAN} Conference on Programming Language Design and Implementation},pages={508--518},year={2014},url={http://doi.acm.org/10.1145/2594291.2594293},doi={10.1145/2594291.2594293}}
Bobby Powers, John Vilk, and Emery D. Berger. Browsix: Bridging the Gap Between Unix and the Browser.InProceedings of the Twenty-Second International Conference on Architectural Supportfor Programming Languages and Operating Systems (2017), pp. 253–266.
references
@inproceedings{PowersBrowsix,author={Bobby Powers and John Vilk and Emery D. Berger},title={{Browsix: Bridging the Gap Between Unix and the Browser}},booktitle={Proceedings of the Twenty-Second International Conference on Architectural Support for Programming Languages and Operating Systems},pages={253--266},year={2017},url={http://doi.acm.org/10.1145/3037697.3037727},doi={10.1145/3037697.3037727}}
ThisOS.js BrowserFS Adapter is licensed under the MIT License.
It embed a fork ofBroofa mime that is under the MIT License.
OS.js,BrowserFS, andZenFS are also licensed under the MIT License.
SeeLICENSE.txt andbroofa-mime.js for details.
npm install saoirse-iontach/osjs-browserfs-adapter# @osjs/browserfs-adapter
If you fork@BrowserFS-iontach, then add the following to yourpackage.json:
"scripts": {"dependencies":"npx bfs-adapter-prepare","test":"npx bfs-adapter-test" },"dependencies": {"@browserfs/core":"...","@browserfs/fs-dom":"..." }
Then if you remove a@browserfs/*
, you must donpm ci
.
Run simple tests withnpx bfs-adapter-test
.
Then analyze console output.
Register adapter in yoursrc/client/index.js
bootstrap file:
importbfsAdapterfrom'@osjs/browserfs-adapter';osjs.register(VFSServiceProvider,{args:{adapters:{bfs:bfsAdapter}}});
Then create mountpoints in yoursrc/client/config.js
file:
(and provide missing mime type)
{mime:{filenames:{// 'filename': 'mime/type''Makefile':'text/x-makefile','.gitignore':'text/plain'},define:{// 'mime/type': ['ext']'text/x-lilypond':['ly','ily'],'text/x-python':['py'],'application/tar+gzip':['tgz']}},vfs:{mountpoints:[{name:'localstorage',label:'Browser low data',adapter:'bfs',attributes:{fs:'Storage'}},{name:'opfs',label:'Browser files',adapter:'bfs',attributes:{fs:'FileSystemAccess'}},{name:'debug-bfs',label:'BrowserFS internals',adapter:'bfs',attributes:{root:'/'}},{name:'test-shortcut',label:'My Documents',adapter:'bfs',attributes:{root:'opfs:/MyDocuments'}}]}}
mountpoint.root
is the vfs path prefix.attributes.root
is the bfs path prefix.
This is use for path translation on vfs operation.
attributes.fs
is the bfs backend name.attributes.mountpoint
is the bfs mountpoint.
This is used (if provided) to mount a backend.
Useattributes['/subpath']
to mount a nested backend.
Then you can provide either astring
for backend name,
or a nestedobject
for backend config and inner nest.
attributes.options
will be pass to backend.
Else othersattributes.xxx
will be pass asoptions
.
// Await allimportbfsAdapterfrom'@osjs/browserfs-adapter';const{mime, core, dom, browserfs, adapter}=awaitbfsAdapter.default;
// Await someimportbfsAdapterfrom'@osjs/browserfs-adapter';constmime=awaitbfsAdapter.mime;constadapter=awaitbfsAdapter.adapter;
// Don't wait for the adapterimportbfsAdapterfrom'@osjs/browserfs-adapter';constadapter=bfsAdapter.preload;// adapter will wait to complete mount,// andwill be updated to awaited bfsAdapter.adapter
// internals api, to build your custom adapterimportbfsAdapterfrom'@osjs/browserfs-adapter';const{ browserfs, upgradeFs, mountHandler, mountOperations, vfsOperations, mime, vfsMime}=awaitbfsAdapter.adapter;
Open_index.html
in a browser to have a view of exports.
Then in the browser console, you can play with:
require
: the requirejs module loaderadapter
: the adapter factory (see basic usage)modules
: the bundled submodules (see advanced usage)
See theOS.js Official Manuals for articles, tutorials and guides.
See theBrowserFS Coreand theBrowserFS DOM for configuring backends.
About
@browserfs VFS Adapter for OS.js
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.