@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 +34 -13
- package/dist/index.min.js +1 -1
- package/dist/src/index.d.ts +10 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +16 -11
- package/src/index.ts +10 -10
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
# @helia/mfs
|
|
7
|
+
# @helia/mfs
|
|
8
8
|
|
|
9
9
|
[](https://ipfs.tech)
|
|
10
10
|
[](https://discuss.ipfs.tech)
|
|
@@ -13,21 +13,42 @@
|
|
|
13
13
|
|
|
14
14
|
> A mutable filesystem powered by Helia
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
# About
|
|
17
17
|
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
70
|
+
# Contribute
|
|
50
71
|
|
|
51
72
|
Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-mfs/issues).
|
|
52
73
|
|