multiformats / multiformats/js-multiformats

Remove `cid.buffer` in favor of `cid.bytes.buffer` to avoid issues with node libraries

Open
#30 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
268
Forks
57
PR merge metrics
No merged PRs in 30d

Description

https://github.com/multiformats/js-multiformats/pull/29 repurposed former buffer: Buffer property to buffer: ArrayBuffer property that as @mikeal points out can lead to issues in node land that would happily accept either and mutate it.

This means that it could lead to issues when cid.byteOffset > 0 || cid.byteLength !== cid.buffer.byteLength. To avoid these problems we can rename .buffer to .arrayBuffer instead.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the CID implementation and all references to cid.buffer, including existing tests and documentation. Check how byteOffset and byteLength relate to the exposed buffer, then update the affected references and run the repository's existing test suite. Done means the renamed property is used consistently and the old ambiguous property is no longer exposed.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.