# dwebx-encoding

> Encode and decode DWebX links

Latest version **1.0.0** (published 2020-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install dwebx-encoding
pnpm add dwebx-encoding
yarn add dwebx-encoding
bun add dwebx-encoding
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-10-21 |
| First published | 2020-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | peepslabs |

## Links

- npm: https://www.npmjs.com/package/dwebx-encoding
- Repository: https://github.com/distributedweb/dwebx-encoding
- Homepage: https://github.com/distributedweb/dwebx-encoding#readme
- Issues: https://github.com/distributedweb/dwebx-encoding/issues
- npm.io page: https://npm.io/package/dwebx-encoding

## Dependencies (1)

- [safe-buffer](https://npm.io/package/safe-buffer.md) ^5.0.1

## Recent versions

- 1.0.0 (latest) — 2020-10-21

## README

# dwebx-encoding

[DWebX](http://dwebx-data.com/)'s way of encoding and decoding dwebx links.

[![Build Status](https://travis-ci.org/juliangruber/dwebx-encoding.svg?branch=master)](https://travis-ci.org/juliangruber/dwebx-encoding)

## Example

```js
var encoding = require('dwebx-encoding')

var link = '6161616161616161616161616161616161616161616161616161616161616161'
var buf = encoding.decode(link)
console.log('%s -> %s', link, buf)
console.log('%s -> %s', buf, encoding.encode(buf))
```

## API

### .encode(buf)
### .toStr(buf)

Encode `buf` into a hex string. Throws if `buf` isn't 32 bytes of length.

If `buf` is already a string, checks if it's valid and returns it.

### .decode(str)
### .toBuf(str)

Decode `str` into its binary representation. Also supports `dwebx://` and `dwebx.com/` links. Throws if the raw link isn't 64 bytes of base64.

If `str` is already a buffer, checks if it's valid and returns it.

## License

MIT

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