function amf0encArray(a) {
  let l = 0;
  if (a instanceof Array) l = a.length; else l = Object.keys(a).length;
  logger.debug("Array encode", l, a);
  let buf = Buffer.alloc(5);
  buf.writeUInt8(8, 0);
  buf.writeUInt32BE(l, 1);
  let data = amf0encObject(a);
  return Buffer.concat([buf, data.subarray(1)]);
}
AMF0 Encode Array
@param {Array} a
@returns {Buffer}