Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

saoirse-iontach/osjs-browserfs-adapter

Repository files navigation

OS.js BrowserFS Adapter

HomeDocChatForum  BrowserfsBfs-CoreBfs-Dom

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.

Projectauthortimelinelinks
BrowserFSJohn Vilk2014 - 2017npmgithub
@BrowserFSdr-Vortex09/2023 - 03/2024npmgithub
@ZenFSdr-Vortex03/2024 - ...npmgithub

Important

Next version probably move back to originaljVilk BrowserFS

Citing

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}}

License

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.

Installation

npm install saoirse-iontach/osjs-browserfs-adapter# @osjs/browserfs-adapter

Overriding BrowserFS dependencies

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.

Testing

Run simple tests withnpx bfs-adapter-test.
Then analyze console output.

Usage

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.

advanced usage

// 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 loader
  • adapter: the adapter factory (see basic usage)
  • modules: the bundled submodules (see advanced usage)

Documentation

See theOS.js Official Manuals for articles, tutorials and guides.
See theBrowserFS Coreand theBrowserFS DOM for configuring backends.

Links


[8]ページ先頭

©2009-2025 Movatter.jp