# drop-file-dataurl

> Specify a drop area and get a dataurl. Simple as that.

Latest version **0.0.0** (published 2014-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install drop-file-dataurl
pnpm add drop-file-dataurl
yarn add drop-file-dataurl
bun add drop-file-dataurl
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2014-07-30 |
| First published | 2014-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Finn Pauls |
| Maintainers | finnpauls |
| Keywords | dataurl, drop, dnd, dragandrop, filereader |

## Links

- npm: https://www.npmjs.com/package/drop-file-dataurl
- Repository: https://github.com/finnp/node-drop-file-dataurl
- Issues: https://github.com/finnp/node-drop-file-dataurl/issues
- npm.io page: https://npm.io/package/drop-file-dataurl

## Dependencies (1)

- [drag-and-drop-files](https://npm.io/package/drag-and-drop-files.md) 0.0.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.0 (latest) — 2014-07-30

## README

# drop-file-dataurl

Module for creating a drop area where people can drop files and you will get 
the data-uri as a callback. Install it with `npm install drop-file-dataurl`.
This is created for the use with [Browserify](http://browserify.org/).


## Usage
```js
  require('drop-file-dataurl')(droparea, callback[, check])
```
where the dataURL is passed to the `callback`. 

The optional `check` function
takes the [File object](https://developer.mozilla.org/en-US/docs/Web/API/File)
and the return value determines whether the second callback will be fired or not. 
This is useful for mime-type filtering.

## Example

### Simple Usage
```js
  var dropfile = require('drop-file-dataurl')
  var droparea = document.querySelector('#droparea')
  dropfile(droparea, function (dataURL) {
    console.log('The file', dataURL)
  })
```


### Usage with check

```js
  dropfile(droparea, 
  function (dataURL) {
    // note that the context of the callback is the droparea.
    this.querySelector('img').src = dataURL
  },
  function (file) {
    return file.type.split('/')[0] === 'image'
  })
```

### Run an example

If you have `beefy` installed, you can run an example with
`npm run example` (see `examples` folder).

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