npm.io
2.1.20 • Published 3 weeks ago

html-encode

Licence
MIT
Version
2.1.20
Deps
4
Size
6 kB
Vulns
0
Weekly
0
Stars
3

html-encode

Last version Coverage Status NPM Status

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

Install

$ npm install html-encode

Usage

'use strict'

const contentType = require('@kikobeats/content-type')
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, contentType(headers['content-type']))
  console.log(str)
})()

See more at examples.

License

html-encode Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · X @Kikobeats

Keywords