@helia/unixfs 6.0.1-faac4ad3 → 6.0.2
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 +10 -3
- package/dist/index.min.js +7 -2
- package/dist/index.min.js.map +3 -3
- package/dist/src/index.d.ts +10 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -3
- package/dist/src/index.js.map +1 -1
- package/dist/typedoc-urls.json +76 -0
- package/package.json +2 -2
- package/src/index.ts +10 -3
package/README.md
CHANGED
|
@@ -76,18 +76,25 @@ for await (const entry of fs.addAll(globSource('path/to/containing/dir', 'glob-p
|
|
|
76
76
|
|
|
77
77
|
## Example - Adding files and directories in the browser
|
|
78
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.
|
|
79
|
+
Uses [@cypsela/browser-source](https://github.com/cypsela/browser-source) to read [FileList](https://developer.mozilla.org/en-US/docs/Web/API/FileList), [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
80
|
|
|
81
|
-
Instances of these data types are available from drag
|
|
81
|
+
Instances of these data types are available from [\<input type="file" />](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file) elements, [drag-and-drop events](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drop_event), and window methods like [showOpenFilePicker](https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker).
|
|
82
82
|
|
|
83
83
|
```typescript
|
|
84
84
|
import { createHelia } from 'helia'
|
|
85
85
|
import { unixfs } from '@helia/unixfs'
|
|
86
|
-
import { fsEntrySource, fsHandleSource } from '@cypsela/browser-source'
|
|
86
|
+
import { fileListSource, fsEntrySource, fsHandleSource } from '@cypsela/browser-source'
|
|
87
87
|
|
|
88
88
|
const helia = await createHelia()
|
|
89
89
|
const fs = unixfs(helia)
|
|
90
90
|
|
|
91
|
+
// get FileList from <input type="file" /> elements
|
|
92
|
+
const fileList = {} as FileList
|
|
93
|
+
|
|
94
|
+
for await (const entry of fs.addAll(fileListSource(fileList))) {
|
|
95
|
+
console.info(entry)
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
// get FileSystemEntry from drag and drop events
|
|
92
99
|
const fileEntry = {} as FileSystemEntry
|
|
93
100
|
|