Skip to content

Commit b4ac638

Browse files
committed
feat: add IPLD formats to table
1 parent 66b361d commit b4ac638

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/base-table.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,45 @@
22

33
const varint = require('varint')
44

5+
// spec and table at: https://github.com/multiformats/multicodec
6+
7+
// TODO revisit all of these once https://github.com/multiformats/multicodec/pull/16 is merged
8+
59
exports = module.exports
610

711
// Miscellaneous
812
exports.raw = varintBuf(0) // 0x00
913

10-
// Multiformats
11-
exports.multicodec = varintBuf(64) // 0x40
12-
exports.multihash = varintBuf(65) // 0x41
13-
exports.multiaddr = varintBuf(66) // 0x42
14+
// bases encodings
1415

1516
// Serialization formats
1617
exports.protobuf = varintBuf(80) // 0x50
1718
exports.cbor = varintBuf(81) // 0x51
1819
exports.rlp = varintBuf(96) // 0x60
1920

21+
// Multiformats
22+
exports.multicodec = varintBuf(64) // 0x40
23+
exports.multihash = varintBuf(65) // 0x41
24+
exports.multiaddr = varintBuf(66) // 0x42
25+
26+
// multihashes
27+
28+
// multiaddrs
29+
30+
// archiving formats
31+
32+
// image formats
33+
34+
// video formats
35+
36+
// VCS formats
37+
38+
// IPLD formats
39+
exports['dag-pb'] = new Buffer('70', 'hex')
40+
exports['dag-cbor'] = new Buffer('71', 'hex')
41+
exports['eth-block'] = new Buffer('90', 'hex')
42+
exports['eth-tx'] = new Buffer('91', 'hex')
43+
2044
function varintBuf (n) {
2145
return new Buffer(varint.encode(n))
2246
}

0 commit comments

Comments
 (0)