code: function expiry(expires) {
    var buffer
      , int64;
    if(expires % 1000 === 0) {
      buffer = new Buffer(5);
      buffer.writeUInt8(0xFD, 0);
      buffer.writeInt32LE(expires / 1000, 1);
    }else{
      buffer = new Buffer(9);
      int64 = new Int64(expires);
      buffer.writeUInt8(0xFC, 0);
      buffer.writeUInt32LE(int64.low32(), 1);
      buffer.writeUInt32LE(int64.high32(), 5);
    }
    return buffer;
  }
docs: Get an expiry buffer.