# convert-hex

> Convert to/from hex string and array of bytes

Latest version **0.1.0** (published 2013-11-21) · 0 weekly downloads

## Install

```sh
npm install convert-hex
pnpm add convert-hex
yarn add convert-hex
bun add convert-hex
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2013-11-21 |
| First published | 2013-11-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jp |
| Keywords | string, strings, convert, hex, bytes |

## Links

- npm: https://www.npmjs.com/package/convert-hex
- Repository: https://github.com/cryptocoinjs/convert-hex
- Issues: https://github.com/cryptocoinjs/convert-hex/issues
- npm.io page: https://npm.io/package/convert-hex

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2013-11-21

## README

convert-hex
===========

JavaScript component to convert to/from hex strings and byte arrays.

AMD/CommonJS compatible.


Install
-------

### Node.js/Browserify

    npm install --save cryptocoin-convert-hex


### Component

    component install cryptocoin/convert-hex


### Bower

    bower install cryptocoin/convert-hex


### Script

```html
<script src="/path/to/convert-hex.js"></script>
```


Usage
-----

(if using script, the global is `convertHex`)

### bytesToHex(bytes)

```js
var convertHex = require('convert-hex')

var bytes = [0x34, 0x55, 0x1, 0xDF]
console.log(convertHex.bytesToHex(bytes)) //"345501df"
```


### hexToBytes(hexStr)

```js
var hex = "34550122DF" //"0x" prefix is optional
console.dir(conv.hexToBytes(hex).join(',')) //'[52,85,1,34,223]'
```

Credits
-------

Loosely inspired by code from here: https://github.com/vbuterin/bitcoinjs-lib & CryptoJS


License
-------

(MIT License)

Copyright 2013, JP Richardson  <jprichardson@gmail.com>

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