binary-parser icon indicating copy to clipboard operation
binary-parser copied to clipboard

Getting Error: Specified primitive type "uint16" is not supported.

Open gbisheimer opened this issue 10 years ago • 1 comments

Hi. I'was taking a look at your package and wrote the following code for parsing some binary data structure:

this.TFormula = new Parser().endianess('big').array('sp_macros', {
  type: 'uint16',
  length: 10
}).array('sp_medios', {
  type: 'uint16',
  length: 10
}).array('sp_premix', {
  type: 'uint16',
  length: 10
}).array('sp_otros', {
  type: 'uint16',
  length: 4
}).uint16('sp_premix_manual').uint16('sp_aceite').uint16('sp_excipiente').bit1('con_macros').bit1('con_medios').bit1('con_premix').bit1('con_premix_manual').bit1('con_aceite').bit1('con_otros').bit10('otras_banderas').array('id_macros', {
  type: 'uint16',
  length: 10
}).array('id_medios', {
  type: 'uint16',
  length: 10
}).array('id_premix', {
  type: 'uint16',
  length: 10
}).array('id_otros', {
  type: 'uint16',
  length: 4
}).int16('id').int16('peso_batch').int16('tiempo_mezclado').int16('cant_batchs_premix').string('nombre', {
  length: 20,
  stripNull: true
}).array('fecha', {
  type: 'uint16',
  length: 8
});

I'm getting the error Specified primitive type "uint16" is not supported.. I fixed this replacing the type with uint16be. Is this correct if I'm using endianess('big') at the begining?

Thanks!

gbisheimer avatar Apr 08 '15 04:04 gbisheimer

#gbisheimer, thanks for this tip! Was struggling to figure out what was the problem.

jayachandranm avatar Jul 27 '16 07:07 jayachandranm