superagent-charset-esm
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

superagent-charset-esm

介绍

一个superagent插件,用于设置charset,可用于爬取非unicode中文页面。 作用和superagent-charset一致,这是一个esm+typescript的版本。

安装

npm i superagent-charset-esm -S

使用说明

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(/格力/)

Package Sidebar

Install

npm i superagent-charset-esm

Weekly Downloads

1

Version

1.0.2

License

Apache-2.0

Unpacked Size

19.8 kB

Total Files

11

Last publish

Collaborators

  • taiyosen