IPFS CID transcoding

node v6.17.1
version: master
endpointsharetweet
require("bs58") var hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB' var CID = require('cids') id0 = new CID(hash)
id1 = id0.toV1() 'localhost:8080/ipfs/' + id1.toBaseEncodedString('base32')
new CID(id1.toBaseEncodedString('base16')).toV0().toBaseEncodedString('base58btc') == hash
new CID('QmRXJFzhtsAn9NkeFjv5Vf3ZPKBxjjzuV6BPVYJCqTvStQ')
new CID('QmRXJFzhtsAn9NkeFjv5Vf3ZPKBxjjzuV6BPVYJCqTvStQ').toV1().toBaseEncodedString('base16')
Loading…

no comments

    sign in to comment