This repository was archived by the owner on Mar 10, 2020. It is now read-only.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alanshaw quick question: what values are allowed here?
Ones from https://github.com/multiformats/multibase/blob/master/multibase.csv ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment
go-ipfs
supportstext
andbase64
.Go's
text
is the default (e.g. raw bytes), thoughgo-ipfs
doesn't escape the characters so it's http api can produce strings that are invalid in JSON and hard to replicate in JavaScript sobase64
is safer.Once ipfs/js-ipfs#1420 is in,
js-ipfs
will support whatever Buffer.toString([encoding[, start[, end]]]) does.If we want to add all of the different encodings from that csv it should be pretty straightforward once both implementations support the
data-encoding
argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @achingbrain!
This PR reminded me of yEnc from Usenet days, so I was just looking at efficiency column in encoding standards comparison and things like Ascii85 (used in PDFs and git patch) looked interesting (due to moderate adoption and smaller overhead, eg. 25% instead of 33%).
..but then i remembered that HTTP API is often gzipped which means any gains introduced by more exotic encoding than Base64 go away.
For example: base-64 seems to compress better than base-122 🙃