Gathering detailed insights and metrics for @caoer/token-types
Gathering detailed insights and metrics for @caoer/token-types
Gathering detailed insights and metrics for @caoer/token-types
Gathering detailed insights and metrics for @caoer/token-types
A primitive token library used to read from, and to write a node Buffer
npm install @caoer/token-types
Typescript
Module System
Min. Node Version
Node Version
NPM Version
72.2
Supply Chain
98.9
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
783
Last Day
1
Last Week
8
Last Month
34
Last Year
236
MIT License
11 Stars
663 Commits
8 Forks
2 Watchers
15 Branches
4 Contributors
Updated on Aug 09, 2024
Latest Version
5.0.3
Package Id
@caoer/token-types@5.0.3
Unpacked Size
25.51 kB
Size
6.15 kB
File Count
5
NPM Version
8.1.0
Node Version
16.12.0
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-20%
8
Compared to previous week
Last Month
41.7%
34
Compared to previous month
Last Year
23.6%
236
Compared to previous year
1
21
A primitive token library used to read and write from a Uint8Array
.
Although it is possible to use this module directly, it is primarily designed to be used with strtok3 tokenizer.
Module: version 5 migrated from CommonJS to pure ECMAScript Module (ESM). JavaScript is compliant with ECMAScript 2019 (ES10).
1npm install --save token-types
Usually in combination with strtok3:
1npm install --save strtok3
Using TypeScript you should also install @tokenizer/token as a development dependency:
1npm install --save-dev @tokenizer/token
1import * as strtok3 from 'strtok3'; 2import * as token from 'token-types'; 3 4(async () => { 5 6 const tokenizer = await strtok3.fromFile("somefile.bin"); 7 try { 8 const myNumber = await tokenizer.readToken(token.Float32_BE); 9 console.log(`My number: ${myNumber}`); 10 } finally { 11 tokenizer.close(); // Close the file 12 } 13})();
token-types
supports a wide variety of numeric tokens out of the box:
Token | Number | Bits | Endianness |
---|---|---|---|
UINT8 | Unsigned integer | 8 | n/a |
UINT16_BE | Unsigned integer | 16 | big endian |
UINT16_LE | Unsigned integer | 16 | little endian |
UINT24_BE | Unsigned integer | 24 | big endian |
UINT24_LE | Unsigned integer | 24 | little endian |
UINT32_BE | Unsigned integer | 32 | big endian |
UINT32_LE | Unsigned integer | 32 | little endian |
UINT64_BE | Unsigned integer | 64 | big endian |
UINT64_LE * | Unsigned integer | 64 | little endian |
INT8 | Signed integer | 8 | n/a |
INT16_BE | Signed integer | 16 | big endian |
INT16_LE | Signed integer | 16 | little endian |
INT24_BE | Signed integer | 24 | big endian |
INT24_LE | Signed integer | 24 | little endian |
INT32_BE | Signed integer | 32 | big endian |
INT32_LE | Signed integer | 32 | little endian |
INT64_BE | Signed integer | 64 | big endian |
INT64_LE * | Signed integer | 64 | little endian |
Float16_BE | IEEE 754 float | 16 | big endian |
Float16_LE | IEEE 754 float | 16 | little endian |
Float32_BE | IEEE 754 float | 32 | big endian |
Float32_LE | IEEE 754 float | 32 | little endian |
Float64_BE | IEEE 754 float | 64 | big endian |
Float64_LE | IEEE 754 float | 64 | little endian |
Float80_BE * | IEEE 754 float | 80 | big endian |
Float80_LE * | IEEE 754 float | 80 | little endian |
(*) The tokens exceed the JavaScript IEEE 754 64-bit Floating Point precision, decoding and encoding is best effort based.
StringType decoding is implemented using TextDecoder which supports a large number of encodings including but not limited to:
Check out the MDN web docs for the TextDecoder for a complete list
Custom tokens can be added, suitable for reading binary files or network messages:
1 ExtendedHeader = {
2 len: 10,
3
4 get: (buf, off) => {
5 return {
6 // Extended header size
7 size: Token.UINT32_BE.get(buf, off),
8 // Extended Flags
9 extendedFlags: Token.UINT16_BE.get(buf, off + 4),
10 // Size of padding
11 sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
12 // CRC data present
13 crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31)
14 };
15 }
16 };
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 3/16 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Score
Last Scanned on 2025-05-12
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More