An open API service indexing awesome lists of open source software.

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.

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.