v0.2.0
Pre-release-
Improve performance for reading and writing strings
-
Improve performance for reading variable integers encoded on a single byte
-
Add a reader and a writer for fixed-strings
Users have now access to two new functions that enable to read and
write fixed-length strings.bare.readFixedString(bc, /* string's length in bytes */ 4) bare.writeFixedString(bc, "bare")
-
Simplification of ByteCursor
-
BREAKING CHANGE: rename all decode/encode into read/write
read/write feel more low-level than decode/encode.
read/write are also more used among BARE implementations than decode/encode.
Moreover, in JS, decode and encode are used for high-level API such as
TextDEcoder and TextEncoder.bare.decodeU8(bc) // Previously bare.readU8(bc) // Now bare.encodeU8(bc, 42) // Previously bare.writeU8(bc, 42) // Now
-
BREAKING CHANGE: length can no longer be specified for fixed-array writers
Previously, you had to specify the length of the fixed-array to encode.
If the given length was different of the actual array's length,
then an assertion was thrown ("unmatched length").It is no longer possible to specify the length.
As a consequence, the fixed-array writers can no longer assert the length.Fixed-array writers now have the same signature as other writers.
bare.readerU8FixedArray(bc, Uint8Array.of(42, 24), 2) // Previously bare.writeU8FixedArray(bc, Uint8Array.of(42, 24)) // Now
Note that fixed-array readers still require the specification of the
length:bare.decodeU8FixedArray(bc, 2)
-
BREAKING CHANGE: ByteCursor no longer accept ArrayBuffer
new ByteCursor(new ArrayBuffer(5), config) // Now fails new ByteCursor(new Uint8Array(5), config) // Update to this
-
BREAKING CHANGE: remove
ByteCursor#write
Use
writeU8FixedArray
instead:const bc = new ByteCursor(buffer, config) bc.write(buffer) // Previously bare.writeU8FixedArray(bc, buffer) // Now