code: function unpackResourceRecord(buf, offset) {
    var bytes = 0;
  
    //  - variable length name
    var nbname = NBName.fromBuffer(buf, offset + bytes);
    if (nbname.error) {
      return {error: nbname.error};
    }
  
    bytes += nbname.bytesRead;
  
    var record = {};
    record.nbname = nbname;
  
    //  - 16-bit RR type
    var t = buf.readUInt16BE(offset + bytes);
    bytes += 2;
  
    record.type = con.RR_TYPE_TO_STRING[t];
    if (record.type === undefined) {
      return {
        error: new Error('Illegal resource record type [' + t + '] for name [' +
                         nbname + ']')
      };
    }
    var rdataParser = RR_TYPE_TO_PARSER[record.type];
  
    //  - 16-bit RR class
    var clazz = buf.readUInt16BE(offset + bytes);
    bytes += 2;
  
    if (clazz !== con.CLASS_IN) {
      return {
        error: new Error('Unexpected resource record class [' + clazz +
                         '] for name [' + record.nbname + ']; expected class [' +
                         con.CLASS_IN + '].')
      };
    }
  
    //  - 32-bit TTL
    record.ttl = buf.readUInt32BE(offset + bytes);
    bytes += 4;
  
    //  - 16-bit resource data length in bytes
    var dataLen = buf.readUInt16BE(offset + bytes);
    bytes += 2;
  
    //  - variable length resource data
    var res = rdataParser(buf, offset + bytes, dataLen, record);
    if (res.error) {
      return {error: res.error};
    }
  
    bytes += res.bytesRead;
  
    return {bytesRead: bytes, record: record};
  }
docs: Parse resource record: - variable length name - 16-bit RR type - 16-bit RR class - 32-bit TTL - 16-bit resource data length in bytes - variable length resource data