Skip to content

Commit f2b7a88

Browse files
committed
update readme
1 parent db974b8 commit f2b7a88

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,34 @@
33
node like `fs` API for the browser that uses indexedDB/ fs access browser APIs for persistence.
44

55
## Installation
6+
The library can be either installed using npm or using the CDN link (See usage in browser below ).
7+
8+
### Getting the code locally
9+
Install the library can be downloaded locally with the following command:
10+
11+
```bash
12+
npm install @phcode/fs
13+
```
14+
15+
Once installed, the `virtualfs.js` lib will be present in the following location
16+
```bash
17+
<project_root>/node_modules/@phcode/fs/dist/virtualfs.js
18+
```
619
### Usage in browser
720
Put the below script tag in your html file. A Global `fs` object
821
will be created with the necessary fs APIs.
922
* The fs apis have compatibility with nodejs like fs APIs.
1023
See filer docs for API docs: https://filer.js.org/
1124

1225
```js
13-
<script src="path/to/dist/virtualfs.js"/>
26+
// using CDN link in your html file
27+
<script src="https://unpkg.com/@phcode/fs@latest/dist/virtualfs.js"/>
28+
29+
// OR to get a particular version, change latest to the version you need:
30+
<script src="https://unpkg.com/@phcode/fs@1.0.4/dist/virtualfs.js"/>
31+
32+
// OR if you did npm install
33+
<script src="<project_root>/node_modules/@phcode/fs/dist/virtualfs.js"/>
1434
```
1535

1636
### Usage in web-worker in browser
@@ -21,7 +41,10 @@ started supporting the API yet.
2141
2. Use fs.mountNativeFolder to mount a local directory.
2242
3. After mounting, access the files using the mountPath returned
2343
```js
24-
importScripts('path/to/dist/virtualfs.js');
44+
importScripts('<project_root>/node_modules/@phcode/fs/dist/virtualfs.js');
45+
// OR from CDN directly as
46+
importScripts('https://unpkg.com/@phcode/fs@latest/dist/virtualfs.js');
47+
2548
fs.mountNativeFolder((err, mountPathArray)=>{
2649
console.log(err, mountPathArray);
2750
});

0 commit comments

Comments
 (0)