Skip to content

Commit

Permalink
chore: pull text encoder from ipfs-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Jul 24, 2020
1 parent 0c0b1ee commit db3dcd1
Show file tree
Hide file tree
Showing 9 changed files with 784 additions and 963 deletions.
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
501 changes: 0 additions & 501 deletions packages/ipfs-unixfs-exporter/package-lock.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/ipfs-unixfs-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"err-code": "^2.0.0",
"hamt-sharding": "^1.0.0",
"ipfs-unixfs": "^1.0.2",
"ipfs-utils": "^2.3.1",
"it-last": "^1.0.1",
"multihashing-async": "^1.0.0"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

const Bucket = require('hamt-sharding/src/bucket')
const multihashing = require('multihashing-async')
const TextEncoder = require('ipfs-utils/src/text-encoder')

// FIXME: this is copy/pasted from ipfs-unixfs-importer/src/dir-sharded.js
const hashFn = async function (value) {
const buf = new TextEncoder('utf-8').encode(value)
const buf = new TextEncoder('utf8').encode(value)
const hash = await multihashing(buf, 'murmur3-128')

// Multihashing inserts preamble of 2 bytes. Remove it.
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"err-code": "^2.0.0",
"hamt-sharding": "^1.0.0",
"ipfs-unixfs": "^1.0.2",
"ipfs-utils": "^2.3.1",
"ipld-dag-pb": "^0.19.0",
"it-all": "^1.0.1",
"it-batch": "^1.0.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const errCode = require('err-code')
const TextEncoder = require('ipfs-utils/src/text-encoder')

// make sure the content only emits buffer-a-likes
async function * validateChunks (source) {
Expand Down
1 change: 1 addition & 0 deletions packages/ipfs-unixfs-importer/src/dir-sharded.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const Dir = require('./dir')
const persist = require('./utils/persist')
const Bucket = require('hamt-sharding')
const mergeOptions = require('merge-options').bind({ ignoreUndefined: true })
const TextEncoder = require('ipfs-utils/src/text-encoder')

const hashFn = async function (value) {
const buf = new TextEncoder('utf-8').encode(value)
Expand Down

0 comments on commit db3dcd1

Please sign in to comment.