Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

bumblefudge
Copy link

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

"ipfs-unixfs": "^11.2.0",
"ipfs-unixfs-exporter": "^13.6.1",
"ipfs-unixfs-importer": "^15.3.1",
"libp2p": "^2.1.6",
Copy link
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
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
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
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
Copy link
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
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