What is this and why does it matter? [From the horse's mouth]
Protocol Buffers are awesome. Having schemas to deflate and inflate data while maintaining some kind of validation is a great concept.
Compactr's goal is to build on that to better suit Node development and reduce repetition by allowing you to build schemas for your data directly in your scripting language.
For example, if you have a DB schema for a model, you could use that directly as a schema for Compactr.
constCompactr=require('compactr');// Defining a schemaconstuserSchema=Compactr.schema({id:{type:'number'},name:{type:'string'}});// EncodinguserSchema.write({id:123,name:'John'});// Get the schema header bytes (for partial loads)constheader=userSchema.headerBytes();// Get the partial load bytesconstpartial=userSchema.contentBytes();// Get the full header + content bytesconstbuffer=userSchema.bytes();// Decoding (full)constcontent=userSchema.decode(buffer);// Decoding (partial)constcontent=userSchema.decode(header,partial);