You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make read_bytes() also return the number of bytes read #75
If you traverse a file containing CIDs, you might want to keep track of your current position. Currently read_bytes() only returns the new CID. As varints are involved, you cannot tell by how many bytes the reader was advanced. Hence I propose extending read_bytes() to also return the number of byte read.
I was building an index on top of a file that stores CID + data tuples. I wanted to get the byte offset of the data without asking the reader about its current position after it read a CID.
Activity
mriise commentedon May 3, 2021
this would require api changes in both varint and multihash, and is a bit awkward as bytes read would have to be passed up in both cases somehow.
is there a specific usecase where this would be useful?
vmx commentedon May 10, 2021
I was building an index on top of a file that stores CID + data tuples. I wanted to get the byte offset of the data without asking the reader about its current position after it read a CID.