Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kikobeats/html-encode

A Node.js library for converting HTML documents of arbitrary encoding into a target encoding (utf-8, utf-16, etc).
https://github.com/kikobeats/html-encode

entities html html-encoder html-entities

Last synced: 8 days ago
JSON representation

A Node.js library for converting HTML documents of arbitrary encoding into a target encoding (utf-8, utf-16, etc).

Awesome Lists containing this project

README

        

# html-encode

![Last version](https://img.shields.io/github/tag/Kikobeats/html-encode.svg?style=flat-square)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/html-encode.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/html-encode)
[![NPM Status](https://img.shields.io/npm/dm/html-encode.svg?style=flat-square)](https://www.npmjs.org/package/html-encode)

> A Node.js library for converting HTML documents of arbitrary encoding into a target encoding (utf8, utf16, etc).

### Install

```bash
$ npm install html-encode
```

### Usage

```js
'use strict'

const got = require('got')
const toUTF8 = require('html-encode')('utf-8')
const url = process.argv[2]

;(async () => {
const { body: buffer, headers } = await got(url, { responseType: 'buffer' })
const str = toUTF8(buffer, headers['content-type'])
console.log(str)
})()
```

See more at [examples](/examples).

## License

**html-encode** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/html-encode/blob/master/LICENSE.md) License.

Authored and maintained by Kiko Beats with help from [contributors](https://github.com/Kikobeats/html-encode/contributors).

> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) · Twitter [@Kikobeats](https://twitter.com/Kikobeats)