Allow cli/ tool to read data from stdin #108
Open
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.
The executable in
cli/
is a nice little conversion tool: much lighter than depending on Kubo, and supports more bases than other CLIs I've found. I'm not sure if anybody's actually using it for anything, but I'd like to; however, it does a couple of things which make it unsuitable for scripting. These commits scratch that itch, so I thought I'd upstream them. If it's not appropriate then feel free to ignore me :-)encode
, since binary data (which may contain NUL bytes, etc.) doesn't work well in argument lists; it forces shell scripts to use variables, which can't store it correctly; etc. In contrast, stdio is binary-safe, and requires no variables.Result:
prefix. This makes it less useful for programmatic use.With these changes, the
multibase
executable feels more like a member of coreutils (e.g.base64
), and is much easier to plug into other tools.PS: I'm not a Rust programmer, so might have made some mistakes. It would also be nice to stream the stdio conversion, rather than reading it all into memory; but this is a less invasive change, and fine for my current needs, at least.