@cartbc/codecs-core
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

[![npm][npm-image]][npm-url] [![npm-downloads][npm-downloads-image]][npm-url] [![semantic-release][semantic-release-image]][semantic-release-url]
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

Status of the GitHub Workflow: codes-core NPM version NPM downloads
ThanksDev donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

@cartbc/codecs-core

This package contains the core types and function for encoding and decoding data structures on Cartes. It can be used standalone, but it is also exported as part of the Cartes JavaScript SDK @cartbc/cartes-web3.js.

Types

bytes

Concatenates an array of Uint8Arrays into a single Uint8Array. Reuses the original byte array when applicable.

codec

Defines an offset in bytes

Functions

assertions

Asserts that a given byte array is not empty

combine-codec

Combines an encoder and a decoder into a codec. The encoder and decoder must have the same fixed size, max size and description. If a description is provided, it will override the encoder and decoder descriptions.

fix-codec

Creates a fixed-size encoder from a given encoder.

@param encoder - The encoder to wrap into a fixed-size encoder. @param fixedBytes - The fixed number of bytes to write. @param description - A custom description for the encoder.

map-codec

Converts an encoder A to a encoder B by mapping their values.

reverse-codec

Reverses the bytes of a fixed-size encoder.

Package Sidebar

Install

npm i @cartbc/codecs-core

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

152 kB

Total Files

35

Last publish

Collaborators

  • cartallumtech