@helia/unixfs 5.0.2 → 5.0.3-1e9745c0
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 +30 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/commands/cat.js +1 -1
- package/dist/src/commands/cat.js.map +1 -1
- package/dist/src/commands/chmod.js +1 -1
- package/dist/src/commands/chmod.js.map +1 -1
- package/dist/src/commands/cp.js +1 -1
- package/dist/src/commands/cp.js.map +1 -1
- package/dist/src/commands/ls.js +1 -1
- package/dist/src/commands/ls.js.map +1 -1
- package/dist/src/commands/mkdir.js +1 -1
- package/dist/src/commands/mkdir.js.map +1 -1
- package/dist/src/commands/rm.js +1 -1
- package/dist/src/commands/rm.js.map +1 -1
- package/dist/src/commands/stat.js +1 -1
- package/dist/src/commands/stat.js.map +1 -1
- package/dist/src/commands/touch.js +1 -1
- package/dist/src/commands/touch.js.map +1 -1
- package/dist/src/commands/utils/add-link.d.ts +1 -1
- package/dist/src/commands/utils/add-link.d.ts.map +1 -1
- package/dist/src/commands/utils/dir-sharded.js +1 -1
- package/dist/src/commands/utils/dir-sharded.js.map +1 -1
- package/dist/src/commands/utils/hamt-utils.d.ts +1 -1
- package/dist/src/commands/utils/hamt-utils.d.ts.map +1 -1
- package/dist/src/commands/utils/persist.d.ts.map +1 -1
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +29 -0
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -4
- package/src/commands/cat.ts +1 -1
- package/src/commands/chmod.ts +1 -1
- package/src/commands/cp.ts +1 -1
- package/src/commands/ls.ts +1 -1
- package/src/commands/mkdir.ts +1 -1
- package/src/commands/rm.ts +1 -1
- package/src/commands/stat.ts +1 -1
- package/src/commands/touch.ts +1 -1
- package/src/commands/utils/add-link.ts +1 -1
- package/src/commands/utils/dir-sharded.ts +1 -1
- package/src/index.ts +29 -0
- package/dist/typedoc-urls.json +0 -76
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ repo and examine the changes made.
|
|
|
30
30
|
|
|
31
31
|
-->
|
|
32
32
|
|
|
33
|
-
`@helia/unixfs` is an implementation of a filesystem compatible with Helia.
|
|
33
|
+
`@helia/unixfs` is an implementation of a UnixFS filesystem compatible with Helia.
|
|
34
34
|
|
|
35
35
|
See the [API docs](https://ipfs.github.io/helia/modules/_helia_unixfs.html) for all available operations.
|
|
36
36
|
|
|
@@ -74,6 +74,35 @@ for await (const entry of fs.addAll(globSource('path/to/containing/dir', 'glob-p
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
## Example - Adding files and directories in the browser
|
|
78
|
+
|
|
79
|
+
Uses [@cypsela/browser-source](https://github.com/cypsela/browser-source) to read [FileSystemEntry](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry) and [FileSystemHandle](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle) files and directories.
|
|
80
|
+
|
|
81
|
+
Instances of these data types are available from drag and drop events and window methods like [showOpenFilePicker](https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker).
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { createHelia } from 'helia'
|
|
85
|
+
import { unixfs } from '@helia/unixfs'
|
|
86
|
+
import { fsEntrySource, fsHandleSource } from '@cypsela/browser-source'
|
|
87
|
+
|
|
88
|
+
const helia = await createHelia()
|
|
89
|
+
const fs = unixfs(helia)
|
|
90
|
+
|
|
91
|
+
// get FileSystemEntry from drag and drop events
|
|
92
|
+
const fileEntry = {} as FileSystemEntry
|
|
93
|
+
|
|
94
|
+
for await (const entry of fs.addAll(fsEntrySource(fileEntry))) {
|
|
95
|
+
console.info(entry)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// get FileSystemHandle from drag and drop events or window methods
|
|
99
|
+
const fileHandle = {} as FileSystemHandle
|
|
100
|
+
|
|
101
|
+
for await (const entry of fs.addAll(fsHandleSource(fileHandle))) {
|
|
102
|
+
console.info(entry)
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
77
106
|
# Install
|
|
78
107
|
|
|
79
108
|
```console
|