binary-parser
binary-parser copied to clipboard
Getting Error: Specified primitive type "uint16" is not supported.
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, thanks for this tip! Was struggling to figure out what was the problem.