File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ node_modules
88dist /*
99! dist /virtualfs.js
1010! dist /virtualfs.js.map
11+ phoenix-fs- * .tgz
Original file line number Diff line number Diff line change 33node like ` fs ` API for the browser that uses indexedDB/ fs access browser APIs for persistence.
44
55## Installation
6+ ### Usage in browser
7+ Put the below script tag in your html file. A Global ` fs ` object
8+ will be created with the necessary fs APIs.
9+ * The fs apis have compatibility with nodejs like fs APIs.
10+ See filer docs for API docs: https://filer.js.org/
11+
12+ ``` js
13+ < script src= " path/to/dist/virtualfs.js" / >
14+ ```
15+
16+ ### Usage in web-worker in browser
17+ Inside your web-worker, import the library as below. There are some limitations for
18+ web workers with native fs mount points to keep in mind:
19+ 1 . Native fs aceess based APIs are only available in chrome. This is a platform limitation and firefox have not
20+ started supporting the API yet.
21+ 2 . Use fs.mountNativeFolder to mount a local directory.
22+ 3 . After mounting, access the files using the mountPath returned
23+ ``` js
24+ importScripts (' path/to/dist/virtualfs.js' );
25+ fs .mountNativeFolder ((err , mountPathArray )=> {
26+ console .log (err, mountPathArray);
27+ });
28+ ```
29+
30+ ## Development
631
732To build it:
833
@@ -24,7 +49,3 @@ npm run test
2449The js library will be built in ` dist/nohost-sw.js ` .
2550NOTE: you can also use ` npm run dev ` to also start a web server for development.
2651
27-
28- ``` js
29- < script src= " path/to/dist/virtualfs.js" / >
30- ```
Original file line number Diff line number Diff line change 3131 "url" : " https://github.com/phcode-dev/phoenix-fs"
3232 },
3333 "files" : [
34- " dist/fslib .js" ,
35- " dist/fslib .js.map"
34+ " dist/virtualfs .js" ,
35+ " dist/virtualfs .js.map"
3636 ],
3737 "devDependencies" : {
3838 "browser-mime" : " 1.0.1" ,
You can’t perform that action at this time.
0 commit comments