This repository was archived by the owner on Aug 24, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +48
-114
lines changed Expand file tree Collapse file tree 8 files changed +48
-114
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- # Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories.
2
- sudo : false
3
1
language : node_js
2
+ cache : npm
3
+ stages :
4
+ - check
5
+ - test
6
+ - cov
4
7
5
- matrix :
6
- include :
7
- - node_js : 6
8
- env : CXX=g++-4.8
9
- - node_js : 8
10
- env : CXX=g++-4.8
11
- # - node_js: stable
12
- # env: CXX=g++-4.8
8
+ node_js :
9
+ - ' 10 '
10
+ - ' 12 '
11
+
12
+ os :
13
+ - linux
14
+ - osx
15
+ - windows
13
16
14
- script :
15
- - npm run lint
16
- - npm run test
17
- - npm run coverage
17
+ script : npx nyc -s npm run test:node -- --bail
18
+ after_success : npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
19
+
20
+ jobs :
21
+ include :
22
+ - stage : check
23
+ script :
24
+ - npx aegir commitlint --travis
25
+ - npx aegir dep-check
26
+ - npm run lint
18
27
19
- before_script :
20
- - export DISPLAY=:99.0
21
- - sh -e /etc/init.d/xvfb start
28
+ - stage : test
29
+ name : chrome
30
+ addons :
31
+ chrome : stable
32
+ script : npx aegir test -t browser -t webworker
22
33
23
- after_success :
24
- - npm run coverage-publish
34
+ - stage : test
35
+ name : firefox
36
+ addons :
37
+ firefox : latest
38
+ script : npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless
25
39
26
- addons :
27
- firefox : ' latest'
28
- apt :
29
- sources :
30
- - ubuntu-toolchain-r-test
31
- packages :
32
- - g++-4.8
40
+ notifications :
41
+ email : false
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-console */
1
2
'use strict'
2
3
3
4
const multihash = require ( 'multihashes' )
Original file line number Diff line number Diff line change 17
17
"coverage" : " aegir coverage" ,
18
18
"coverage-publish" : " aegir coverage --provider coveralls"
19
19
},
20
+ "files" : [
21
+ " src" ,
22
+ " dist"
23
+ ],
20
24
"repository" : {
21
25
"type" : " git" ,
22
26
"url" : " git://github.com/multiformats/js-multihash.git"
30
34
},
31
35
"dependencies" : {
32
36
"bs58" : " ^4.0.1" ,
37
+ "buffer" : " ^5.5.0" ,
38
+ "multibase" : " ^0.6.0" ,
33
39
"varint" : " ^5.0.0"
34
40
},
35
41
"devDependencies" : {
36
- "aegir" : " ^15.1 .0" ,
42
+ "aegir" : " ^21.3 .0" ,
37
43
"buffer-equal" : " 1.0.0" ,
38
44
"chai" : " ^4.1.2" ,
39
45
"dirty-chai" : " ^2.0.1" ,
Original file line number Diff line number Diff line change 5
5
*/
6
6
'use strict'
7
7
8
- const bs58 = require ( 'bs58' )
9
-
8
+ const { Buffer } = require ( 'buffer' )
9
+ const multibase = require ( 'multibase' )
10
+ const varint = require ( 'varint' )
10
11
const cs = require ( './constants' )
11
12
12
13
exports . names = cs . names
13
14
exports . codes = cs . codes
14
15
exports . defaultLengths = cs . defaultLengths
15
16
16
- const varint = require ( 'varint' )
17
-
18
17
/**
19
18
* Convert the given multihash to a hex encoded string.
20
19
*
@@ -50,7 +49,7 @@ exports.toB58String = function toB58String (hash) {
50
49
throw new Error ( 'must be passed a buffer' )
51
50
}
52
51
53
- return bs58 . encode ( hash )
52
+ return multibase . encode ( 'base58btc' , hash ) . toString ( ) . slice ( 1 )
54
53
}
55
54
56
55
/**
@@ -65,7 +64,7 @@ exports.fromB58String = function fromB58String (hash) {
65
64
encoded = hash . toString ( )
66
65
}
67
66
68
- return Buffer . from ( bs58 . decode ( encoded ) )
67
+ return multibase . decode ( 'z' + encoded )
69
68
}
70
69
71
70
/**
You can’t perform that action at this time.
0 commit comments