Skip to content

chore: remove node buffers from runtime code #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lerna": "3.20.2",
"lerna": "3.22.1",
"packages": [
"packages/*"
],
Expand Down
1,235 changes: 776 additions & 459 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"update-contributors": "aegir release --lint=false --test=false --bump=false --build=false --changelog=false --commit=false --tag=false --push=false --ghrelease=false --docs=false --publish=false"
},
"devDependencies": {
"lerna": "^3.20.2"
"lerna": "^3.22.1"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/ipfs-unixfs-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const files = []

for await (const file of importer([{
path: '/foo/bar.txt',
content: Buffer.from(0, 1, 2, 3)
content: new Uint8Array([0, 1, 2, 3])
}], ipld)) {
files.push(file)
}
Expand All @@ -74,7 +74,7 @@ for await (const buf of entry.content({
bytes.push(buf)
}

const content = Buffer.concat(bytes)
const content = new Uint8Array(bytes)

console.info(content) // 0, 1, 2, 3
```
Expand Down Expand Up @@ -185,7 +185,7 @@ for await (const chunk of entry.content({
}

// `data` contains the first 5 bytes of the file
const data = Buffer.concat(bufs)
const data = new Uint8Array(bufs)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm afraid this is incorrect:

[...new Uint8Array([ new Uint8Array([1, 2, 3]), new Uint8Array([4, 5]) ])] // [0, 0]

It's probably best to change line 184 to bufs.push(...chunk)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated it to use Unit8Array.set instead.

```

If `entry` is a directory or hamt shard, passing `offset` and/or `length` to `entry.content()` will limit the number of files returned from the directory.
Expand Down
Loading