From b4ac638003dd9108761be16f21bec1030fa4f443 Mon Sep 17 00:00:00 2001 From: David Dias Date: Sun, 2 Oct 2016 15:36:45 +0100 Subject: [PATCH] feat: add IPLD formats to table --- src/base-table.js | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/base-table.js b/src/base-table.js index 929c125..fcb9bf4 100644 --- a/src/base-table.js +++ b/src/base-table.js @@ -2,21 +2,45 @@ const varint = require('varint') +// spec and table at: https://github.com/multiformats/multicodec + +// TODO revisit all of these once https://github.com/multiformats/multicodec/pull/16 is merged + exports = module.exports // Miscellaneous exports.raw = varintBuf(0) // 0x00 -// Multiformats -exports.multicodec = varintBuf(64) // 0x40 -exports.multihash = varintBuf(65) // 0x41 -exports.multiaddr = varintBuf(66) // 0x42 +// bases encodings // Serialization formats exports.protobuf = varintBuf(80) // 0x50 exports.cbor = varintBuf(81) // 0x51 exports.rlp = varintBuf(96) // 0x60 +// Multiformats +exports.multicodec = varintBuf(64) // 0x40 +exports.multihash = varintBuf(65) // 0x41 +exports.multiaddr = varintBuf(66) // 0x42 + +// multihashes + +// multiaddrs + +// archiving formats + +// image formats + +// video formats + +// VCS formats + +// IPLD formats +exports['dag-pb'] = new Buffer('70', 'hex') +exports['dag-cbor'] = new Buffer('71', 'hex') +exports['eth-block'] = new Buffer('90', 'hex') +exports['eth-tx'] = new Buffer('91', 'hex') + function varintBuf (n) { return new Buffer(varint.encode(n)) }