Package Exports
- token-types
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (token-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
A primitive token library used to read from, and to write a node Buffer.
Tokens
node-strtok supports a wide variety of numerical tokens out of the box:
UINT8UINT16_BE,UINT16_LEUINT24_BE,UINT24_LEUINT32_BE,UINT32_LEUINT64_BE,UINT64_LE*INT8INT16_BE,INT16_LEINT24_BE,INT24_LEINT32_BE,INT32_LEINT64_BE,UINT64_LE*
String types:
- Windows-1252
- ISO-8859-1
*) The 64-bit tokens are best effort based, since JavaScript limit value size to less than 2^64.
Complex tokens can be added, which makes very suitable for reading binary files or network messages:
ExtendedHeader = {
len: 10,
get: (buf, off) => {
return {
// Extended header size
size: Token.UINT32_BE.get(buf, off),
// Extended Flags
extendedFlags: Token.UINT16_BE.get(buf, off + 4),
// Size of padding
sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
// CRC data present
crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31)
};
}
};