Skip to content

feat(examples): add UnixFS builder example with HAMT sharding #851

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

PsychoPunkSage
Copy link
Contributor

Closes #663

This PR adds a new example demonstrating how to programmatically create UnixFS DAGs with features similar to ipfs add. The example shows how to:

  • Create UnixFS structures from files and directories
  • Handle large directories using HAMT sharding
  • Preserve file metadata (mtime, mode)
  • Customize chunking strategies
  • Display progress with human-readable sizes

The example includes proper error handling, tests, and documentation for common use cases. This helps developers understand how to work with UnixFS programmatically using boxo's lower-level APIs.

Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
Signed-off-by: Abhinav Prakash <[email protected]>
@PsychoPunkSage PsychoPunkSage requested a review from a team as a code owner February 20, 2025 12:14
@PsychoPunkSage
Copy link
Contributor Author

Hi @lidel
Can you have a quick look here as soon as you find some time?

@gammazero
Copy link
Contributor

gammazero commented Mar 11, 2025

@PsychoPunkSage Thank you for your interest in this. However, we generally recommend doing this using MFS and would prefer a published example to show that. If other techniques are necessary, then it indicates a need for revised APIs instead of extensive examples.

@gammazero gammazero marked this pull request as draft March 11, 2025 15:38
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.

example: turn directory into UnixFS DAG
3 participants