Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

fix: replace node buffers with uint8arrays #202

Merged
merged 2 commits into from
Aug 10, 2020

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Aug 7, 2020

Replaces all use of node Buffers with Uint8Arrays

BREAKING CHANGES:

- Where node Buffers were returned, now Uint8Arrays are
@@ -329,7 +329,7 @@ describe('Query', () => {

it('disjoint path values', async () => {
const peerId = dht.peerId
const values = ['v0', 'v1'].map(Buffer.from)
const values = ['v0', 'v1'].map((str) => uint8ArrayFromString(str))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you could pass uint8ArrayFromString directly to map, here and in two more cases below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature for the function passed to Array.map is function callback( currentValue[, index[, array]]), so if you just pass uint8ArrayFromString it tries to interpret the index as a text encoding and fails.

@jacobheun jacobheun merged commit 989be87 into master Aug 10, 2020
@jacobheun jacobheun deleted the fix/replace-node-buffers-with-uint8arrays branch August 10, 2020 11:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants