Skip to content

Add 102 tutorial for CID generation configurations and CID profiles#455

Open
bumblefudge wants to merge 8 commits into
ipfs-examples:mainfrom
bumblefudge:feat/add-102-cid-profiles
Open

Add 102 tutorial for CID generation configurations and CID profiles#455
bumblefudge wants to merge 8 commits into
ipfs-examples:mainfrom
bumblefudge:feat/add-102-cid-profiles

Conversation

@bumblefudge
Copy link
Copy Markdown

Thanks to @achingbrain and @2color for getting me started on this!

Comment thread examples/helia-101/102-cid-profiles.js
Comment thread examples/helia-101/README.md Outdated
Comment thread examples/helia-101/README.md Outdated
Comment thread examples/helia-101/README.md Outdated
Comment thread examples/helia-101/package.json Outdated
"ipfs-unixfs": "^11.2.0",
"ipfs-unixfs-exporter": "^13.6.1",
"ipfs-unixfs-importer": "^15.3.1",
"libp2p": "^2.1.6",
Copy link
Copy Markdown
Contributor

@2color 2color Mar 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add libp2p and exporter explicitly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. This is my bad. libp2p was already in here because we import it directly in the 301 example.

const bigHtmlFile = createReadStream('./2600-h.htm')

// generate CID according to Helia defaults (~== kubo v1 profile) from bigHtmlFile:
const cidBigHTML = await fs.addFile(
Copy link
Copy Markdown
Contributor

@2color 2color Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simplify this by having helia download the file for you as I did in

const urlCid = await fs.addFile(urlSource(url))

https://github.com/ipfs-examples/helia-examples/pull/456/files#diff-15db2a7c59c6093dbf74da5c6c0132ad792799c35a93eabe589cf6cd00d1019dR65

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought having a local file would simplify the comparison to kubo, since i don't think the latter has a "from URL" option? this is neat, tho, maybe it makes sense to add it as a 5th example before the local-file version to show that it's the same CID between urlSource(url) and the local file curled from the same URL... i leave it to the tutorials' editor to decide!

bumblefudge and others added 4 commits March 14, 2025 15:22
Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com>
Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com>
Co-authored-by: Daniel Norman <1992255+2color@users.noreply.github.com>
@bumblefudge
Copy link
Copy Markdown
Author

(I'll incorporate the changes above before un-drafting, if i ever do!)

@bumblefudge bumblefudge marked this pull request as ready for review April 2, 2025 15:34
@bumblefudge
Copy link
Copy Markdown
Author

No strong opinions on whether they gets merged into #465 or otherwise reworked stylistically, I just want there to be a stable github URL i can send people when they ask how to get the equivalent determinism of the kubo profiles in helia!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants