Socket
Socket
Sign inDemoInstall

pvutils

Package Overview
Dependencies
0
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

pvutils


Version published
Maintainers
2
Created

Package description

What is pvutils?

The pvutils npm package provides a set of utility functions for working with ASN.1 and DER encoded data, commonly used in cryptographic applications. It simplifies the process of encoding and decoding data structures, making it easier to handle complex binary data formats.

What are pvutils's main functionalities?

Buffer Concatenation

This feature allows you to concatenate multiple ArrayBuffer objects into a single ArrayBuffer. It is useful when you need to combine binary data from different sources.

const pvutils = require('pvutils');
const buffer1 = new Uint8Array([1, 2, 3]);
const buffer2 = new Uint8Array([4, 5, 6]);
const concatenatedBuffer = pvutils.utilConcatBuf(buffer1.buffer, buffer2.buffer);
console.log(new Uint8Array(concatenatedBuffer));

String to ArrayBuffer Conversion

This feature converts a string into an ArrayBuffer, which is useful for encoding text data into a binary format.

const pvutils = require('pvutils');
const str = 'Hello, World!';
const arrayBuffer = pvutils.stringToArrayBuffer(str);
console.log(new Uint8Array(arrayBuffer));

ArrayBuffer to String Conversion

This feature converts an ArrayBuffer back into a string, which is useful for decoding binary data back into a readable text format.

const pvutils = require('pvutils');
const buffer = new Uint8Array([72, 101, 108, 108, 111]).buffer;
const str = pvutils.arrayBufferToString(buffer);
console.log(str);

Hexadecimal Encoding

This feature converts an ArrayBuffer into a hexadecimal string representation, which is useful for debugging and displaying binary data in a human-readable format.

const pvutils = require('pvutils');
const buffer = new Uint8Array([255, 0, 128]).buffer;
const hexString = pvutils.bufferToHexCodes(buffer);
console.log(hexString);

Other packages similar to pvutils

Changelog

Source

1.1.3 (2022-03-02)

Bug Fixes

  • Issue #13 (7eb8b1d)

Readme

Source

pvutils

test Coverage Status

pvutils is a set of common utility functions used in various Peculiar Ventures Javascript based projects.

Some example capabilities included in pvutils include:

  • Converting dates into UTC,
  • Converting an "ArrayBuffer" into a hexdecimal string,
  • Converting a number from 2^base to 2^10,
  • Converting a number from 2^10 to 2^base,
  • Concatenate two ArrayBuffers,
  • And more...

FAQs

Last updated on 02 Mar 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc