feat: extract specific path, accept stdin as streaming input #384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(WIP: needs better testing, it works with the very limited test data I have at hand)
--path
(-p
) to extract just a specific unixfs path (and its children)-
as a possible input for--file
(-f
) to read from stdin - the catch here is that it reads it into memory, so a large CAR is going to be a problem; but it will at least extract as the CAR blocks come in.So
cat foo.car | car extract -f - -p /my/specific/file.txt
is a thing .. which will be even neater withlassie fetch <cid>/my/specific/file.txt -o -
; when I make that a thing.I think I might have also fixed the macos-12 flaky test problem, maybe it's not a github.com/rogpeppe/go-internal problem after all but related to how macos-12 handles buffered file reads.