# easy-formdata

> a module to parse formdata

Latest version **1.0.2** (published 2020-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install easy-formdata
pnpm add easy-formdata
yarn add easy-formdata
bun add easy-formdata
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-03-15 |
| First published | 2020-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | ali_ahmed |

## Links

- npm: https://www.npmjs.com/package/easy-formdata
- Repository: https://github.com/AliBasicCoder/easy-formdata
- npm.io page: https://npm.io/package/easy-formdata

## Dependencies (1)

- [busboy](https://npm.io/package/busboy.md) ^0.3.1

## Recent versions

- 1.0.2 (latest) — 2020-03-15
- 1.0.1 — 2020-03-15
- 1.0.0 — 2020-03-15

## README

# easy-formdata

```easy-formdata``` is a module to parse form data easily

## Usage

```js
const { expressParser, isFile } = require("easy-formdata");
const express = require("express");
const app = express();

app.use(expressParser());

app.post("/api", ({ body }, res) => {
  for(const key in body){
    if(isFile(body[key]))
      console.log(`${key} is ${body[key].size} bytes file`);
    else
      console.log(`${key} is a text field`);  
  }
  res.send(body);
})

app.listen(4000, () => console.log("server started"));
```

## Types

### expressParser

is the middleware that parsers the formdata for [express](https://github.com/expressjs/express)

### isFile

returns true if the argument passed is a [File](#File) Object

### File

an interface having this properties

```js
  interface File {
    /** the file name */
    filename: string;
    /** the encoding of the file  */
    encoding: string;
    /** the mimetype of the file */
    mimetype: string;
    /** the size of the file */
    size: number;
    /** the data of the file */
    data: Buffer;
  }
```

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