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

browser-string-hexer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-string-hexer

A simple function for encoding a utf-8 string as a hex string.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
209
increased by12.37%
Maintainers
1
Weekly downloads
 
Created
Source

Browser String Hexer

Take a string, get it as hex-encoded UTF-8 back!

Equivalent to the node operation of Buffer.from(YOUR_INPUT, 'utf8').toString('hex'), but in the browser, in one function.

You could just copy-paste it, it's very simple, but I realized that I hadn't shared this in a reusable form, and had taken for granted that I had Buffer in a browserify context in the past.

Useful for performing personal_sign invocations in MetaMask.

Installation

npm install browser-string-hexer or yarn add browser-string-hexer.

Usage

import hexer from 'browser-string-hexer';

const hex = hexer("hello");
// hex === '0x68656c6c6f'

FAQs

Package last updated on 30 Jan 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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc