# browser-string-hexer

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

Latest version **1.0.0** (published 2022-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install browser-string-hexer
pnpm add browser-string-hexer
yarn add browser-string-hexer
bun add browser-string-hexer
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-01-30 |
| First published | 2022-01-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 142 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Dan Finlay |
| Maintainers | danfinlay |

## Links

- npm: https://www.npmjs.com/package/browser-string-hexer
- Repository: https://github.com/danfinlay/browser-string-hexer
- Homepage: https://github.com/danfinlay/browser-string-hexer#readme
- Issues: https://github.com/danfinlay/browser-string-hexer/issues
- npm.io page: https://npm.io/package/browser-string-hexer

## Dependencies (142)

- [ms](https://npm.io/package/ms.md) ^2.1.3
- [del](https://npm.io/package/del.md) ^6.0.0
- [mem](https://npm.io/package/mem.md) ^9.0.2
- [cbor](https://npm.io/package/cbor.md) ^8.1.0
- [glob](https://npm.io/package/glob.md) ^7.2.0
- [once](https://npm.io/package/once.md) ^1.4.0
- [plur](https://npm.io/package/plur.md) ^5.1.0
- [y18n](https://npm.io/package/y18n.md) ^5.0.8
- [acorn](https://npm.io/package/acorn.md) ^8.7.0
- [arrgv](https://npm.io/package/arrgv.md) ^1.0.2
- [chalk](https://npm.io/package/chalk.md) ^5.0.0
- [cliui](https://npm.io/package/cliui.md) ^7.0.4
- [debug](https://npm.io/package/debug.md) ^4.3.3
- [fastq](https://npm.io/package/fastq.md) ^1.13.0
- [p-map](https://npm.io/package/p-map.md) ^5.3.0
- [slash](https://npm.io/package/slash.md) ^3.0.0
- [yargs](https://npm.io/package/yargs.md) ^17.3.1
- [arrify](https://npm.io/package/arrify.md) ^3.0.0
- [braces](https://npm.io/package/braces.md) ^3.0.2
- [chunkd](https://npm.io/package/chunkd.md) ^2.0.1
- [globby](https://npm.io/package/globby.md) ^12.2.0
- [ignore](https://npm.io/package/ignore.md) ^5.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [merge2](https://npm.io/package/merge2.md) ^1.4.1
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [semver](https://npm.io/package/semver.md) ^7.3.5
- [wrappy](https://npm.io/package/wrappy.md) ^1.0.2
- [ci-info](https://npm.io/package/ci-info.md) ^3.3.0
- [esprima](https://npm.io/package/esprima.md) ^4.0.1
- [esutils](https://npm.io/package/esutils.md) ^2.0.3
- [figures](https://npm.io/package/figures.md) ^4.0.0
- [find-up](https://npm.io/package/find-up.md) ^6.2.0
- [is-glob](https://npm.io/package/is-glob.md) ^4.0.3
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.14.1
- [matcher](https://npm.io/package/matcher.md) ^5.0.0
- [md5-hex](https://npm.io/package/md5-hex.md) ^3.0.1
- [p-defer](https://npm.io/package/p-defer.md) ^1.0.0
- [p-event](https://npm.io/package/p-event.md) ^5.0.1
- [p-limit](https://npm.io/package/p-limit.md) ^4.0.0
- [reusify](https://npm.io/package/reusify.md) ^1.0.4
- [yallist](https://npm.io/package/yallist.md) ^4.0.0
- [anymatch](https://npm.io/package/anymatch.md) ^3.1.2
- [argparse](https://npm.io/package/argparse.md) ^1.0.10
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.3
- [dir-glob](https://npm.io/package/dir-glob.md) ^3.0.1
- [emittery](https://npm.io/package/emittery.md) ^0.10.0
- [escalade](https://npm.io/package/escalade.md) ^3.1.1
- [fsevents](https://npm.io/package/fsevents.md) ^2.3.2
- [inflight](https://npm.io/package/inflight.md) ^1.0.6
- [inherits](https://npm.io/package/inherits.md) ^2.0.4
- [is-error](https://npm.io/package/is-error.md) ^2.2.2
- [mimic-fn](https://npm.io/package/mimic-fn.md) ^4.0.0
- [nofilter](https://npm.io/package/nofilter.md) ^3.1.0
- [p-locate](https://npm.io/package/p-locate.md) ^6.0.0
- [parse-ms](https://npm.io/package/parse-ms.md) ^2.1.0
- [pkg-conf](https://npm.io/package/pkg-conf.md) ^4.0.0
- [readdirp](https://npm.io/package/readdirp.md) ^3.6.0
- [supertap](https://npm.io/package/supertap.md) ^2.0.0
- [temp-dir](https://npm.io/package/temp-dir.md) ^2.0.0
- [callsites](https://npm.io/package/callsites.md) ^4.0.0
- [date-time](https://npm.io/package/date-time.md) ^3.1.0
- [fast-diff](https://npm.io/package/fast-diff.md) ^1.2.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.11
- [is-number](https://npm.io/package/is-number.md) ^7.0.0
- [lru-cache](https://npm.io/package/lru-cache.md) ^6.0.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [p-timeout](https://npm.io/package/p-timeout.md) ^5.0.2
- [path-type](https://npm.io/package/path-type.md) ^4.0.0
- [picomatch](https://npm.io/package/picomatch.md) ^2.3.1
- [pretty-ms](https://npm.io/package/pretty-ms.md) ^7.0.1
- [time-zone](https://npm.io/package/time-zone.md) ^1.0.0
- [type-fest](https://npm.io/package/type-fest.md) ^0.13.1
- [wrap-ansi](https://npm.io/package/wrap-ansi.md) ^7.0.0
- [acorn-walk](https://npm.io/package/acorn-walk.md) ^8.2.0
- [ansi-regex](https://npm.io/package/ansi-regex.md) ^5.0.1
- [color-name](https://npm.io/package/color-name.md) ^1.1.4
- [concat-map](https://npm.io/package/concat-map.md) ^0.0.1
- [fill-range](https://npm.io/package/fill-range.md) ^7.0.1
- [is-extglob](https://npm.io/package/is-extglob.md) ^2.1.1
- [is-promise](https://npm.io/package/is-promise.md) ^4.0.0
- [micromatch](https://npm.io/package/micromatch.md) ^4.0.4
- [slice-ansi](https://npm.io/package/slice-ansi.md) ^5.0.0
- [sprintf-js](https://npm.io/package/sprintf-js.md) ^1.0.3
- [strip-ansi](https://npm.io/package/strip-ansi.md) ^6.0.1
- [ansi-styles](https://npm.io/package/ansi-styles.md) ^6.1.0
- [array-union](https://npm.io/package/array-union.md) ^3.0.1
- [blueimp-md5](https://npm.io/package/blueimp-md5.md) ^2.19.0
- [clean-stack](https://npm.io/package/clean-stack.md) ^4.1.0
- [concordance](https://npm.io/package/concordance.md) ^5.0.4
- [emoji-regex](https://npm.io/package/emoji-regex.md) ^8.0.0
- [fs.realpath](https://npm.io/package/fs.realpath.md) ^1.0.0
- [glob-parent](https://npm.io/package/glob-parent.md) ^5.1.2
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.9
- [imurmurhash](https://npm.io/package/imurmurhash.md) ^0.1.4
- [is-path-cwd](https://npm.io/package/is-path-cwd.md) ^2.2.0
- [locate-path](https://npm.io/package/locate-path.md) ^7.0.0
- [path-exists](https://npm.io/package/path-exists.md) ^5.0.0
- [resolve-cwd](https://npm.io/package/resolve-cwd.md) ^3.0.0
- [signal-exit](https://npm.io/package/signal-exit.md) ^3.0.6
- [stack-utils](https://npm.io/package/stack-utils.md) ^2.0.5
- [yocto-queue](https://npm.io/package/yocto-queue.md) ^1.0.0
- [cli-truncate](https://npm.io/package/cli-truncate.md) ^3.1.0
- [code-excerpt](https://npm.io/package/code-excerpt.md) ^3.0.0
- [resolve-from](https://npm.io/package/resolve-from.md) ^5.0.0
- [run-parallel](https://npm.io/package/run-parallel.md) ^1.2.0
- [string-width](https://npm.io/package/string-width.md) ^4.2.3
- [yargs-parser](https://npm.io/package/yargs-parser.md) ^21.0.0
- [color-convert](https://npm.io/package/color-convert.md) ^2.0.1
- [indent-string](https://npm.io/package/indent-string.md) ^4.0.0
- [is-typedarray](https://npm.io/package/is-typedarray.md) ^1.0.0
- [balanced-match](https://npm.io/package/balanced-match.md) ^1.0.2
- [eastasianwidth](https://npm.io/package/eastasianwidth.md) ^0.2.0
- [is-binary-path](https://npm.io/package/is-binary-path.md) ^2.1.0
- [is-path-inside](https://npm.io/package/is-path-inside.md) ^3.0.3
- [load-json-file](https://npm.io/package/load-json-file.md) ^7.0.1
- [normalize-path](https://npm.io/package/normalize-path.md) ^3.0.0
- [to-regex-range](https://npm.io/package/to-regex-range.md) ^5.0.1
- [aggregate-error](https://npm.io/package/aggregate-error.md) ^4.0.0
- [brace-expansion](https://npm.io/package/brace-expansion.md) ^1.1.11
- [get-caller-file](https://npm.io/package/get-caller-file.md) ^2.0.5
- [is-plain-object](https://npm.io/package/is-plain-object.md) ^5.0.0
- [map-age-cleaner](https://npm.io/package/map-age-cleaner.md) ^0.1.3
- [queue-microtask](https://npm.io/package/queue-microtask.md) ^1.2.3
- [serialize-error](https://npm.io/package/serialize-error.md) ^7.0.1
- [array-find-index](https://npm.io/package/array-find-index.md) ^1.0.2
- [ci-parallel-vars](https://npm.io/package/ci-parallel-vars.md) ^1.0.1
- [js-string-escape](https://npm.io/package/js-string-escape.md) ^1.0.1
- [path-is-absolute](https://npm.io/package/path-is-absolute.md) ^1.0.1
- [binary-extensions](https://npm.io/package/binary-extensions.md) ^2.2.0
- [clean-yaml-object](https://npm.io/package/clean-yaml-object.md) ^0.1.0
- [convert-to-spaces](https://npm.io/package/convert-to-spaces.md) ^1.0.2
- [ignore-by-default](https://npm.io/package/ignore-by-default.md) ^2.0.0
- [irregular-plurals](https://npm.io/package/irregular-plurals.md) ^3.3.0
- [require-directory](https://npm.io/package/require-directory.md) ^2.1.1
- [write-file-atomic](https://npm.io/package/write-file-atomic.md) ^3.0.3
- [common-path-prefix](https://npm.io/package/common-path-prefix.md) ^3.0.0
- [well-known-symbols](https://npm.io/package/well-known-symbols.md) ^2.0.0
- [currently-unhandled](https://npm.io/package/currently-unhandled.md) ^0.4.1
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^5.0.0
- [is-unicode-supported](https://npm.io/package/is-unicode-supported.md) ^1.1.0
- [typedarray-to-buffer](https://npm.io/package/typedarray-to-buffer.md) ^3.1.5
- [is-fullwidth-code-point](https://npm.io/package/is-fullwidth-code-point.md) ^3.0.0

## Recent versions

- 1.0.0 (latest) — 2022-01-30

## README

# 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](https://metamask.github.io/api-playground/api-documentation/#personal_sign) invocations in MetaMask.

## Installation

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

## Usage

```javascript
import hexer from 'browser-string-hexer';

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

---
_Source: https://npm.io/package/browser-string-hexer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
