This repository has been archived by the owner on Aug 11, 2021. 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.
Basically, I ran into this because I mis-read the README and started putting in string data into
DAGNode.create
! If you do this, the current behaviour allows a number of odd/confusing scenarios, and it's not clear that you've done something wrong.Currently, if a string is put in as the data, it will be accepted, and will work when put or gotten from IPFS, but it will break if you try and clone the DAGNode due to the line
dagNode.data.copy(data)
(js strings don't have a copy method).Passing in string data seemed like a reasonable thing to do, but I felt converting the input data string to a buffer would be better than allowing the internal DAGNode data to be a string - I felt having two internal data representations would perhaps cause other unknown problems, however, I am open to reverse this!
Also fixed a small typo in the README, because why not :)