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

bite

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

bite

Lightweight library for bytestring to/from number decoding/encoding, in pure javascript.

  • 0.1.0-4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
Maintainers
1
Weekly downloads
 
Created
Source

bite

Lightweight library for word decoding in pure javascript. Contains methods for decoding/encoding bytestring words to/from numbers (signed and unsigned, big and little endian).

API

  • decodeWord(< Buffer >buffer, [< bool >signed], [< bool >bigEndian]) - (void)
    Decodes a word contained in buffer, i.e. all of buffer is treated as one word. Treats the word as signed if signed is set to true (false is default), and big endian if bigEndian is set to true (false is default).

  • encodeWord(< Buffer >buffer, < number >value, [< bool >signed], [< bool >bigEndian]) - (buffer)
    Encodes a number value into a bytestring word of the same length as buffer, and stores the result in buffer. Will create the word as signed if signed is set to true (false is default), and big endian if bigEndian is set to true (false is default). The buffer provided is returned for convenience.

Example

var bite = require('bite');

var buffer = new Buffer([0xFF, 0xFF]);
var value = bite.decodeWord(buffer, true); // = -1
var word = bite.encodeWord(new Buffer(2), value); // = <Buffer ff ff>

Keywords

FAQs

Package last updated on 10 Feb 2013

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