Gotcha: Reading shorts [blog]

1 · Remy Sharp · July 8, 2020, 12:43 p.m.
Summary
Just in case you came here to find out what kind of shorts you need to wear for the best reading experience, I'll tell you up front: you'll be disappointed. A short is a 16 bit integer. Though I think this is just as interesting! Recently I had a requirement to read a file that contained an array of 16bit values. This means pairs of bytes. When we read files in the browser or in Node we get byte (8bit) and the process should be straight forward to view this data as 16bit data, but, as you might ...