# jsdom-add-files

> An easy way to add files to HTML file inputs in jsdom

Latest version **1.0.2** (published 2021-10-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install jsdom-add-files
pnpm add jsdom-add-files
yarn add jsdom-add-files
bun add jsdom-add-files
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score; declining downloads.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-10-16 |
| First published | 2021-10-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | john-doherty |

## Links

- npm: https://www.npmjs.com/package/jsdom-add-files
- Repository: https://github.com/john-doherty/jsdom-add-files
- Homepage: https://github.com/john-doherty/jsdom-add-files#readme
- Issues: https://github.com/john-doherty/jsdom-add-files/issues
- npm.io page: https://npm.io/package/jsdom-add-files

## Dependencies (2)

- [jsdom](https://npm.io/package/jsdom.md) ^10.1.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.33

## Recent versions

- 1.0.2 (latest) — 2021-10-16
- 1.0.1 — 2021-10-16
- 1.0.0 — 2021-10-16

## README

# jsdom-add-files

Adds local files to a HTML file input in jsdom and fires the `change` event. Inspired by jsdom ticket [#1272](https://github.com/jsdom/jsdom/issues/1272)

## Install

```bash
npm install --save jsdom-add-files
```

## Usage

```js
var path = require('path');
var jsdomAddFiles = require('jsdom-add-files');

// get file input
var fileInput = document.querySelector('input[type="file"]');

// add files (automatically fires onchange event)
jsdomAddFiles(fileInput, [
    path.join(__dirname, 'file1.jpg'),
    path.join(__dirname, 'file2.jpg'),
    path.join(__dirname, 'file3.png')
]);
```

## License

Licensed under [MIT License](LICENSE) &copy; [John Doherty](https://twitter.com/mrjohndoherty)

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