@helia/mfs 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
- # @helia/mfs <!-- omit in toc -->
7
+ # @helia/mfs
8
8
 
9
9
  [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
10
10
  [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
@@ -13,21 +13,42 @@
13
13
 
14
14
  > A mutable filesystem powered by Helia
15
15
 
16
- ## Table of contents <!-- omit in toc -->
16
+ # About
17
17
 
18
- - [Install](#install)
19
- - [Browser `<script>` tag](#browser-script-tag)
20
- - [API Docs](#api-docs)
21
- - [License](#license)
22
- - [Contribute](#contribute)
18
+ `@helia/mfs` is an implementation of a Mutable File System powered by Helia.
23
19
 
24
- ## Install
20
+ See the interface for all available operations.
21
+
22
+ ## Example
23
+
24
+ ```typescript
25
+ import { createHelia } from 'helia'
26
+ import { mfs } from '@helia/mfs'
27
+
28
+ const helia = createHelia({
29
+ // ... helia config
30
+ })
31
+ const fs = mfs(helia)
32
+
33
+ // create an empty directory
34
+ await fs.mkdir('/my-directory')
35
+
36
+ // add a file to the directory
37
+ await fs.writeBytes(Uint8Array.from([0, 1, 2, 3]), '/my-directory/foo.txt')
38
+
39
+ // read the file
40
+ for await (const buf of fs.cat('/my-directory/foo.txt')) {
41
+ console.info(buf)
42
+ }
43
+ ```
44
+
45
+ # Install
25
46
 
26
47
  ```console
27
48
  $ npm i @helia/mfs
28
49
  ```
29
50
 
30
- ### Browser `<script>` tag
51
+ ## Browser `<script>` tag
31
52
 
32
53
  Loading this module through a script tag will make it's exports available as `HeliaMfs` in the global namespace.
33
54
 
@@ -35,18 +56,18 @@ Loading this module through a script tag will make it's exports available as `He
35
56
  <script src="https://unpkg.com/@helia/mfs/dist/index.min.js"></script>
36
57
  ```
37
58
 
38
- ## API Docs
59
+ # API Docs
39
60
 
40
- - <https://ipfs.github.io/helia-mfs/modules.html>
61
+ - <https://ipfs.github.io/helia-mfs/modules/_helia_mfs.html>
41
62
 
42
- ## License
63
+ # License
43
64
 
44
65
  Licensed under either of
45
66
 
46
67
  - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
47
68
  - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
48
69
 
49
- ## Contribute
70
+ # Contribute
50
71
 
51
72
  Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-mfs/issues).
52
73