Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c830fae

Browse files
authored
Updated globSource example with options (#3037)
Previously, before globSource, all options were passed in to ipfs.addFromFs together as one options object. With globSource, `recursive` and `hidden` are now separated out from the options that are traditionally passed into IPFS and are now passed in specifically to globSource. This PR updates the example for adding files with ipfs.add and globSource to reflect that there should be two separate options objects when using globSource to add from the fileSystem and also wanting to pass in additional options to IPFS.
1 parent ee8b769 commit c830fae

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/core-api/FILES.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,19 @@ const { globSource } = IPFS
247247

248248
const ipfs = await IPFS.create()
249249

250-
for await (const file of ipfs.add(globSource('./docs', { recursive: true }))) {
250+
//options specific to globSource
251+
const globSourceOptions = {
252+
recursive: true
253+
};
254+
255+
//example options to pass to IPFS
256+
const addOptions = {
257+
pin: true,
258+
wrapWithDirectory: true,
259+
timeout: 10000
260+
};
261+
262+
for await (const file of ipfs.add(globSource('./docs', globSourceOptions), addOptions)) {
251263
console.log(file)
252264
}
253265

0 commit comments

Comments
 (0)