code: function Packet(arg) {
    if (this instanceof Packet === false) {
      return new Packet(arg);
    }
  
    if (arg === undefined) {
      throw new TypeError('arg should be a Buffer object or a number of slots');
    }
  
    if (Buffer.isBuffer(arg)) { // initialize from a buffer
      if (arg.length < 126) {
        throw new RangeError('buffer size should be of at least 126 bytes');
      }
      this._buffer = arg;
    }
    else if (Number.isInteger(arg)) { // initialize using number of slots
      if (arg < 1 || arg > 512) {
        throw new RangeError("number of slots should be in the range [1-512]");
      }
      this._buffer = Buffer.alloc(126 + arg);
    }
  
    this._rootLayer = new RootLayer(this._buffer.slice(0, 38));
    this._frameLayer = new FrameLayer(this._buffer.slice(38, 115));
    this._dmpLayer = new DMPLayer(this._buffer.slice(115));
  
    if (Number.isInteger(arg)) {
      this.init(arg);
    }
  }
docs: packet object constructor