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

bipack

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bipack

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/spb-web/bipack/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/spb-web/bipack/tree/master) [![GitHub issues](https://img.shields.io/github/issues/spb-web/bipack?color=%2

  • 0.0.1-alpha.0
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Bipack 🥡

CircleCI GitHub issues

Use size-limit to control bundle size.

  dist/index.js
  Size limit: 4 kB
  Size:       1.96 kB with all dependencies, minified and gzipped
  
  dist/index.mjs
  Size limit: 4 kB
  Size:       1.12 kB with all dependencies, minified and gzipped

Introduction

Supported field types

  • Bytes
    Types bytes1, bytes2, bytes3, …, bytes32 hold a sequence of bytes from one to up to 32.
  • Integers
    int / uint: Signed and unsigned integers of various sizes. Types uint8 to uint256 in steps of 8 (unsigned of 8 up to 256 bits) and int8 to int256.
  • Booleans
    The possible values are constants true and false.

A quick example

So what does code that uses Bipack look like?

import {Bipack, StructTypes} from 'bipack'

const bipack = new Bipack({
  ethAddress: StructTypes.bytes20,
  txHash: StructTypes.bytes32,
  balance: StructTypes.uint256,
  success: StructTypes.bool,
})

const input = {
  ethAddress: '0x0123456789abcdef3c0e5929fe01464f45ee03f6',
  txHash: '0xc02fd5fc71fe8bdc4fec3f97a019a4dc9961eb95e5251c55fcb3da76f5cb5bca',
  balance: 9223372036854775807n,
  success: true,
}

const packedString: string = bipack.wrapToString(input)

const unpacked = bipack.unwrapFromString(packedString)

console.log(deepEqual(unpacked, input)) // true

FAQs

Package last updated on 27 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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