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

node-buffer-encoding

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

node-buffer-encoding

A little wrapper around Node's Buffer that provides encoding/decoding for all supported encodings.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Node Buffer Encoding

A little wrapper around Node's Buffer that provides encoding/decoding for all supported encodings.

If you have access to Node's Buffer you probably just want to use it directly instead. This module provides a unified API to some of my other modules, and allows me not to import "@types/node" everywhere.

Install

npm install --save node-buffer-encoding

Usage

import Encoding from 'node-buffer-encoding';

// Encode an Uint8Array with the given encoding
Encoding.encode ( new Uint8Array ([ 0, 255 ]), 'hex' ); // => '00ff'

// Encode a string with the given encoding
Encoding.encodeStr ( 'hello', 'base64' ); // => 'aGVsbG8='

// Decode a string with the given encoding to an Uint8Array
Encoding.decode ( '00ff', 'hex' ); // => Uint8Array(2) [ 0, 255 ]

// Decode a string with the given encoding to a string
Encoding.decodeStr ( 'aGVsbG8=', 'base64' ); // => 'hello'

License

MIT © Fabio Spampinato

Keywords

FAQs

Package last updated on 04 Apr 2024

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