2.1.0 • Published 5 years ago

@sonetjs/binary-parser v2.1.0

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

Binary parser for webapi

WARNING You should not use this lib directly. Its made for @sonetjs/webapi.

Add own types

In case to add own serializeable type one should use defineType function

const {Encoder, Decoder} from '@sonetjs/binary-parser';
const encoder = new Encoder();
const decoder = new Decoder();

let typeName = 'Your type name';
let isTypeCheck = (value) => true; // Function should return true if value is needed type
let read = (self) => result; // One should use ready types to define its own
let write = (self, value) => result; // One should use ready types to define its onw 

encoder.defineType();
decoder.defineType();

// Now encoder and decoder are aware of new type

Ready types

  • self.UNDEFINED
  • self.NULL
  • self.EMPTY_STRING
  • self.CHAR
  • self.STRING_8
  • self.STRING_16
  • self.STRING_32
  • self.UINT_8
  • self.UINT_16
  • self.UINT_32
  • self.INT_8
  • self.INT_16
  • self.INT_32
  • self.BOOLEAN
  • self.FLOAT
  • self.ARRAY_8
  • self.ARRAY_16
  • self.ARRAY_32
  • self.OBJECT_8
  • self.OBJECT_16
  • self.OBJECT_32

Some day there will be a website with all documentation to my projects

2.1.0

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago