Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

token-types

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

token-types - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

4

package.json
{
"name": "token-types",
"version": "1.2.0",
"description": "Common token types for decoding and encoding binairy values",
"version": "1.2.1",
"description": "Common token types for decoding and encoding numeric and string values",
"author": {

@@ -6,0 +6,0 @@ "name": "Borewit",

[![Build Status](https://travis-ci.org/Borewit/token-types.svg?branch=master)](https://travis-ci.org/Borewit/token-types)
[![NPM version](https://badge.fury.io/js/token-types.svg)](https://npmjs.org/package/token-types)
[![npm downloads](http://img.shields.io/npm/dm/token-types.svg)](https://npmjs.org/package/token-types)
[![npm downloads](http://img.shields.io/npm/dm/token-types.svg)](https://npmcharts.com/compare/token-types,strtok3?start=1200&interval=30)
[![Dependencies](https://david-dm.org/Borewit/token-types.svg)](https://david-dm.org/Borewit/token-types)

@@ -12,6 +12,6 @@ [![coveralls](https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master)](https://coveralls.io/github/Borewit/token-types?branch=master)

# strtok3
# token-types
A primitive token library used to read from, and to write a node `Buffer`.
Although it is possible to use this module directly, it is designed to be used with [strtok3 tokenizer](https://github.com/Borewit/strtok3).
A primitive token library used to read and write from a node `Buffer`.
Although it is possible to use this module directly, it is primary designed to be used with [strtok3 tokenizer](https://github.com/Borewit/strtok3).

@@ -23,5 +23,24 @@ ## Installation

```
## Example
```js
const strtok3 = require('strtok3');
const token = require('token-types');
(async () => {
const tokenizer = await strtok3.fromFile("somefile.bin");
try {
const myNumber = await tokenizer.readToken(token.Float32_BE);
console.log(`My number: ${myNumber}`);
} finally {
tokenizer.close(); // Close the file
}
})();
```
## Tokens
### Numeric tokens
`node-strtok` supports a wide variety of numerical tokens out of the box:

@@ -58,2 +77,4 @@

### Other tokens
String types:

@@ -65,4 +86,6 @@ * Windows-1252

### Custom token
Complex tokens can be added, which makes very suitable for reading binary files or network messages:
```javascript
```jS
ExtendedHeader = {

@@ -69,0 +92,0 @@ len: 10,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc