Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit 641a8a1

Browse files
committed
Use multihashes for sanitization.
1 parent 3df6167 commit 641a8a1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"aegir": "^4.0.0",
3838
"async": "^1.5.2",
3939
"block-stream2": "^1.1.0",
40-
"bs58": "^3.0.0",
4140
"buffer-loader": "0.0.1",
4241
"chai": "^3.5.0",
4342
"concat-stream": "^1.5.1",
@@ -61,6 +60,7 @@
6160
"ipfs-unixfs": "^0.1.0",
6261
"is-ipfs": "^0.2.0",
6362
"isstream": "^0.1.2",
63+
"multihashes": "^0.2.2",
6464
"readable-stream": "^1.1.13",
6565
"run-series": "^1.1.4",
6666
"streamifier": "^0.1.1",

src/clean-multihash.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict'
22

3-
const bs58 = require('bs58')
3+
const mh = require('multihashes')
44
const isIPFS = require('is-ipfs')
55

66
module.exports = function (multihash) {
77
if (!isIPFS.multihash(multihash)) {
88
throw new Error('not valid multihash')
99
}
1010
if (Buffer.isBuffer(multihash)) {
11-
return bs58.encode(multihash)
11+
return mh.toB58String(multihash)
1212
}
1313
return multihash
1414
}

0 commit comments

Comments
 (0)