Kikobeats / html-encode

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

html-encode

Last version Build Status 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 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.

License

The code is available under MIT license.

About

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

License:MIT License


Languages

Language:JavaScript 100.0%