# isomorphic-form-data

> A library to create readable "multipart/form-data" in node and the browser.

Latest version **2.0.0** (published 2018-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install isomorphic-form-data
pnpm add isomorphic-form-data
yarn add isomorphic-form-data
bun add isomorphic-form-data
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-07-20 |
| First published | 2015-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/isomorphic-form-data) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | Dylan Piercey |
| Maintainers | dylanpiercey |

## Links

- npm: https://www.npmjs.com/package/isomorphic-form-data
- Repository: https://github.com/form-data/isomorphic-form-data
- Homepage: https://github.com/form-data/isomorphic-form-data#readme
- Issues: https://github.com/form-data/isomorphic-form-data/issues
- npm.io page: https://npm.io/package/isomorphic-form-data

## Dependencies (1)

- [form-data](https://npm.io/package/form-data.md) ^2.3.2

## Recent versions

- 2.0.0 (latest) — 2018-07-20
- 1.0.0 — 2017-03-08
- 0.0.1 — 2015-08-09

## README

A library to create readable ```"multipart/form-data"``` isomorphically in node and the browser.

[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions

## Install

```
npm install isomorphic-form-data
```

## Usage

In this example we are constructing a form with 3 fields that contain a string,
a buffer and a file stream.

``` javascript
require('isomorphic-form-data');
var fs = require('fs');

var form = new FormData();
form.append('my_field', 'my value');
form.append('my_buffer', new Buffer(10));
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
```

#### node-fetch

You can submit a form using [node-fetch](https://github.com/matthew-andrews/isomorphic-fetch):

```javascript
var form = new FormData();

form.append('a', 1);

fetch('http://example.com', { method: 'POST', body: form })
    .then(function(res) {
        return res.json();
    }).then(function(json) {
        console.log(json);
    });
```

## License

Form-Data is licensed under the MIT license.

---
_Source: https://npm.io/package/isomorphic-form-data · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
