@helia/unixfs 5.0.2 → 5.0.3-235e5c40

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.
Files changed (43) hide show
  1. package/README.md +30 -1
  2. package/dist/index.min.js +1 -1
  3. package/dist/index.min.js.map +4 -4
  4. package/dist/src/commands/cat.js +1 -1
  5. package/dist/src/commands/cat.js.map +1 -1
  6. package/dist/src/commands/chmod.js +1 -1
  7. package/dist/src/commands/chmod.js.map +1 -1
  8. package/dist/src/commands/cp.js +1 -1
  9. package/dist/src/commands/cp.js.map +1 -1
  10. package/dist/src/commands/ls.js +1 -1
  11. package/dist/src/commands/ls.js.map +1 -1
  12. package/dist/src/commands/mkdir.js +1 -1
  13. package/dist/src/commands/mkdir.js.map +1 -1
  14. package/dist/src/commands/rm.js +1 -1
  15. package/dist/src/commands/rm.js.map +1 -1
  16. package/dist/src/commands/stat.js +1 -1
  17. package/dist/src/commands/stat.js.map +1 -1
  18. package/dist/src/commands/touch.js +1 -1
  19. package/dist/src/commands/touch.js.map +1 -1
  20. package/dist/src/commands/utils/add-link.d.ts +1 -1
  21. package/dist/src/commands/utils/add-link.d.ts.map +1 -1
  22. package/dist/src/commands/utils/dir-sharded.js +1 -1
  23. package/dist/src/commands/utils/dir-sharded.js.map +1 -1
  24. package/dist/src/commands/utils/hamt-utils.d.ts +1 -1
  25. package/dist/src/commands/utils/hamt-utils.d.ts.map +1 -1
  26. package/dist/src/commands/utils/persist.d.ts.map +1 -1
  27. package/dist/src/index.d.ts +29 -0
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/index.js +29 -0
  30. package/dist/src/index.js.map +1 -1
  31. package/package.json +3 -4
  32. package/src/commands/cat.ts +1 -1
  33. package/src/commands/chmod.ts +1 -1
  34. package/src/commands/cp.ts +1 -1
  35. package/src/commands/ls.ts +1 -1
  36. package/src/commands/mkdir.ts +1 -1
  37. package/src/commands/rm.ts +1 -1
  38. package/src/commands/stat.ts +1 -1
  39. package/src/commands/touch.ts +1 -1
  40. package/src/commands/utils/add-link.ts +1 -1
  41. package/src/commands/utils/dir-sharded.ts +1 -1
  42. package/src/index.ts +29 -0
  43. 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