feat(example):add MFS-based UnixFS to CAR example#1056
feat(example):add MFS-based UnixFS to CAR example#1056
Conversation
|
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
|
It seems this issue might have been automatically generated. To help us address it effectively, please provide additional details. We value the use of LLMs for code generation and welcome your contributions but please ensure your submission is of such quality that a maintainer will spend less time reviewing it than implementing it themselves. Verify the code functions correctly and meets our standards. If your change requires tests, kindly include them and ensure they pass. If no further information is provided, the issue will be automatically closed in 7 days. Thank you for your understanding and for aiding us in maintaining quality contributions! |
|
Triage:
|
Closes #663
Summary
Adds a example demonstrating how to create UnixFS DAGs and export them as CAR files using MFS (Mutable File System)
What's Included
✅ Proper Chunking (Not
io.ReadAll)--chunker size-[bytes]--chunker rabin-[min]-[avg]-[max](content-defined)--chunker buzhash✅ Directory Support
✅ HAMT Sharding
--max-directory-links✅ All Major
ipfs addFlags--chunker,--raw-leaves--cid-version,--hash,--inline,--inline-limit--trickle(trickle DAG)--preserve-mode,--preserve-mtime✅ MFS Integration
mfs.NewRoot()to create filesystemmfs.PutNode()for adding nodesroot.Flush()to persist changesExample Usage
Basic File
Output:
Directory
With All Flags
Testing
All 13 tests pass:
$ go test -v === RUN TestBasicFileConversion --- PASS: TestBasicFileConversion (0.00s) === RUN TestLargeFileWithChunking --- PASS: TestLargeFileWithChunking (0.01s) === RUN TestDirectoryConversion --- PASS: TestDirectoryConversion (0.00s) === RUN TestRawLeaves --- PASS: TestRawLeaves (0.00s) === RUN TestTrickleDAG --- PASS: TestTrickleDAG (0.00s) === RUN TestMetadataPreservation --- PASS: TestMetadataPreservation (0.00s) === RUN TestDifferentHashFunctions --- PASS: TestDifferentHashFunctions (0.00s) === RUN TestDifferentChunkers --- PASS: TestDifferentChunkers (0.01s) === RUN TestInvalidHashFunction --- PASS: TestInvalidHashFunction (0.00s) === RUN TestInvalidChunker --- PASS: TestInvalidChunker (0.00s) === RUN TestNonExistentFile --- PASS: TestNonExistentFile (0.00s) === RUN TestLargeDirectoryWithHAMT --- PASS: TestLargeDirectoryWithHAMT (0.03s) PASS ok github.com/ipfs/boxo/examples/unixfs-to-car 0.287sTests cover:
Implementation Details
MFS-Based Workflow
This follows the same pattern as Kubo's
ipfs add --to-files(seekubo/core/commands/add.go).Screenrecording
Screen.Recording.2025-10-20.at.11.39.03.AM.mp4
Documentation
README includes:
ipfs add@lidel this implementation satisfies all listed requirements and is ready for review!