Skip to content

Commit e89e7ef

Browse files
committed
npmPublish changes
1 parent 9312537 commit e89e7ef

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ node_modules
88
dist/*
99
!dist/virtualfs.js
1010
!dist/virtualfs.js.map
11+
phoenix-fs-*.tgz

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@
33
node 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

732
To build it:
833

@@ -24,7 +49,3 @@ npm run test
2449
The js library will be built in `dist/nohost-sw.js`.
2550
NOTE: 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-
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
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",

0 commit comments

Comments
 (0)