https://github.com/node-fetch/fetch-charset-detection
Charset detection and conversion, originally from node-fetch.
https://github.com/node-fetch/fetch-charset-detection
charset-detection conversion fetch nodejs
Last synced: 8 months ago
JSON representation
Charset detection and conversion, originally from node-fetch.
- Host: GitHub
- URL: https://github.com/node-fetch/fetch-charset-detection
- Owner: node-fetch
- License: mit
- Created: 2019-09-29T04:26:01.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-02T11:28:14.000Z (about 1 year ago)
- Last Synced: 2025-04-03T22:22:23.713Z (8 months ago)
- Topics: charset-detection, conversion, fetch, nodejs
- Language: TypeScript
- Homepage:
- Size: 594 KB
- Stars: 10
- Watchers: 3
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# fetch-charset-detection
Detect the encoding of a buffer and stringify it. Originally from [node-fetch](https://github.com/node-fetch/node-fetch).
## Install
```sh
npm install fetch-charset-detection
```
## Usage
```js
import convertBody from 'fetch-charset-detection';
convertBody(content);
```
## API
### convertBody(content, headers?)
#### content
Type: [`Buffer`](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays)
The content to stringify.
#### headers
Type: [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers)
The HTTP headers provided with the content.