1.0.2 • Published 2 years ago

superagent-charset-esm v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

superagent-charset-esm

Description

An superagent plugin to set the charset when parsing. This is an esm & typescript version of superagent-charset.

Installation

npm i superagent-charset-esm -S

Instructions

import superagent from "superagent";
import { superagentCharset } from "superagent-charset-esm";

const req = superagent.get('http://basic.10jqka.com.cn/000651/worth.html')
    .parse(superagentCharset('gbk'))  // set the charset
    .buffer(true)  // to remove the warning from superagent: A custom superagent parser has been set, but buffering strategy for the parser hasn't been configured. 
const res = await req
const m = res.text.match(/格力/)