superagent-charset-esm
v1.0.2
Published
A superagent-charset plugin with esm & typescript.
Downloads
3
Maintainers
Readme
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(/格力/)