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

pvtsutils

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pvtsutils

pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.

  • 1.3.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is pvtsutils?

The pvtsutils npm package provides a set of utilities for working with binary data, particularly in the context of cryptographic operations. It includes functions for encoding and decoding data, converting between different data formats, and performing various binary manipulations.

What are pvtsutils's main functionalities?

Base64 Encoding/Decoding

This feature allows you to encode and decode strings to and from Base64 format, which is commonly used in data transmission and storage.

const pvtsutils = require('pvtsutils');

// Encoding a string to Base64
const base64Encoded = pvtsutils.Convert.ToBase64('Hello, World!');
console.log(base64Encoded); // Outputs: 'SGVsbG8sIFdvcmxkIQ=='

// Decoding a Base64 string
const base64Decoded = pvtsutils.Convert.FromBase64(base64Encoded);
console.log(base64Decoded); // Outputs: 'Hello, World!'

Hex Encoding/Decoding

This feature allows you to encode and decode strings to and from Hex format, which is useful for representing binary data in a human-readable form.

const pvtsutils = require('pvtsutils');

// Encoding a string to Hex
const hexEncoded = pvtsutils.Convert.ToHex('Hello, World!');
console.log(hexEncoded); // Outputs: '48656c6c6f2c20576f726c6421'

// Decoding a Hex string
const hexDecoded = pvtsutils.Convert.FromHex(hexEncoded);
console.log(hexDecoded); // Outputs: 'Hello, World!'

ArrayBuffer Conversion

This feature allows you to convert strings to ArrayBuffer and vice versa, which is useful for handling binary data in web applications.

const pvtsutils = require('pvtsutils');

// Converting a string to ArrayBuffer
const arrayBuffer = pvtsutils.Convert.FromUtf8String('Hello, World!');
console.log(arrayBuffer); // Outputs: ArrayBuffer { byteLength: 13 }

// Converting an ArrayBuffer to a string
const utf8String = pvtsutils.Convert.ToUtf8String(arrayBuffer);
console.log(utf8String); // Outputs: 'Hello, World!'

Other packages similar to pvtsutils

Keywords

FAQs

Package last updated on 22 Nov 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