Skip to content

Commit 27bd5e1

Browse files
committed
Add ESM/CJS support section to readme.md and rearrange Installation section.
1 parent a17fb55 commit 27bd5e1

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

readme.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ Encode `FormData` content into the `multipart/form-data` format
66
[![CI](https://github.com/octet-stream/form-data-encoder/workflows/CI/badge.svg)](https://github.com/octet-stream/form-data-encoder/actions/workflows/ci.yml)
77
[![ESLint](https://github.com/octet-stream/form-data-encoder/workflows/ESLint/badge.svg)](https://github.com/octet-stream/form-data-encoder/actions/workflows/eslint.yml)
88

9+
## Installation
10+
11+
You can install this package using npm:
12+
13+
```sh
14+
npm install form-data-encoder
15+
```
16+
17+
Or yarn:
18+
19+
```sh
20+
yarn add form-data-encoder
21+
```
22+
23+
Or pnpm:
24+
25+
```sh
26+
pnpm add form-data-encoder
27+
```
28+
29+
## ESM/CJS support
30+
31+
This package is targeting ESM and CJS for backwards compatibility reasons and smoothen transition period while you convert your projects to ESM only. Note that CJS support will be removed as [Node.js v12 will reach its EOL](https://github.com/nodejs/release#release-schedule). This change will be released as major version update, so you won't miss it.
32+
933
## Usage
1034

1135
1. To start the encoding process, you need to create a new Encoder instance with the FormData you want to encode:
@@ -278,26 +302,6 @@ const options = {
278302
await fetch("https://httpbin.org/post", options)
279303
```
280304

281-
## Installation
282-
283-
You can install this package using npm:
284-
285-
```sh
286-
npm install form-data-encoder
287-
```
288-
289-
Or yarn:
290-
291-
```sh
292-
yarn add form-data-encoder
293-
```
294-
295-
Or pnpm:
296-
297-
```sh
298-
pnpm add form-data-encoder
299-
```
300-
301305
## API
302306

303307
### `class FormDataEncoder`

0 commit comments

Comments
 (0)