How to use the binary.packVersion function in binary

To help you get started, we’ve selected a few binary examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hellomatty / daap.js / lib / dmap.js View on Github external
function packer(itemTag) {
  switch (contentCodes.definition(itemTag).type) {
    case contentCodes.type.long:
      return binary.packLong;
    case contentCodes.type.int:
      return binary.packInt;
    case contentCodes.type.short:
      return binary.packShort;
    case contentCodes.type.byte:
      return binary.packByte;
    case contentCodes.type.version:
      return binary.packVersion;
    case contentCodes.type.date:
      return binary.packDate;
    case contentCodes.type.string:
      return binary.packString;
    case contentCodes.type.list:
      return function(list, buffer, index) {
        var ptr = index;
        list.forEach(function(child) {        
          encode(child, buffer, ptr);
          ptr += encodedLength(child);;
        });
      
        return buffer;
      };
  }