Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

binkv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binkv

> Typescript library for encoding & decoding binary data

latest
npmnpm
Version
1.0.2
Version published
Weekly downloads
3
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

binkv

Typescript library for encoding & decoding binary data

Field

Fields store basic data, example:

import { Field } from 'binkv';

const firstname = Field.string("john");
const age = Field.int32(42);
const colors = Field.auto(['red', 'green', 'blue']); // .auto() automatically infers

Structure

Structures stores multiple fields, example:

import { Structure, Field } from 'binkv';

const struct = new Structure();
struct.writeField(Field.int32(5013));
struct.writeField(Field.string("hello"));

console.log(struct.data) // holds the binary data

To decode a structure:

import { Structure, Field } from 'binkv';

// we're using the `struct` from the previous example.
const number = struct.readField().toInt32(); // 5013
const stringValue = struct.readField().toString(); // "hello"

Dictionary

Dictionaries are basically key-value stores.

const dict = Dictionary.create({
  firstname: 'john',
  lastname: 'doe',
  age: 42,
  friend: {
    firstname: 'david',
    lastname: 'sharp',
    age: 41
  }
});

dict.getField('firstname')?.toString(); // "john"
dict.getField('lastname')?.toString(); // "doe"
dict.getField('age')?.toInt32(); // 42

const innerDict = dict.getDict('friend');

innerDict?.getField('firstname')?.toString(); // "david" 
innerDict?.getField('lastname')?.toString(); // "sharp"
innerDict?.getField('age')?.toInt32(); // 41

const encoded = dict.getStructure(); // Convert dict to a structure
const decoded = Dictionary.fromStructure(encoded); // Decode structure back into a dict

decoded.getField('firstname')?.toString(); // "john"
decoded.getField('lastname')?.toString(); // "doe"
decoded.getField('age')?.toInt32(); // 42

const decodedInnerDict = decoded.getDict('friend');

decodedInnerDict?.getField('firstname')?.toString(); // "david"
decodedInnerDict?.getField('lastname')?.toString(); // "sharp"
decodedInnerDict?.getField('age')?.toInt32(); // 41

FAQs

Package last updated on 10 Oct 2025

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