{"name":"file-selector","version":"0.4.0","description":"Convert DataTransfer object to a list of File objects","main":"./dist/index.js","module":"./dist/es5/index.js","es2015":"./dist/es2015/index.js","typings":"./dist/index.d.ts","keywords":["drag-and-drop","html5","file-api","DataTransfer","File"],"homepage":"https://github.com/react-dropzone/file-selector","license":"MIT","author":{"name":"Roland Groza","email":"rolandjitsu@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/react-dropzone/file-selector.git"},"scripts":{"prebuild":"yarn run clean","build":"npm-run-all -s compile build:umd","build:umd":"rollup -c ./rollup.config.js","compile":"npm-run-all -p compile:es2015 compile:es5 compile:cjs compile:types","compile:es2015":"tsc -p ./tsconfig.es2015.json","compile:es5":"tsc -p ./tsconfig.es5.json","compile:cjs":"tsc -p ./tsconfig.cjs.json","compile:types":"tsc -p ./tsconfig.types.json","clean":"rm -rf dist/*","lint":"tslint -c tslint.json -p ./tsconfig.spec.json -t stylish","lint:fix":"yarn run lint -- --fix","pretest:cov":"yarn run lint","test:cov":"jest --coverage","test":"jest --watch"},"dependencies":{"tslib":"^2.0.3"},"devDependencies":{"@babel/core":"^7.12.3","@rollup/plugin-commonjs":"^15.1.0","@rollup/plugin-node-resolve":"^9.0.0","@types/jest":"^26.0.15","@types/node":"^14.14.2","babel-jest":"^26.6.0","camelcase":"^6.1.0","jest":"^26.6.0","jest-environment-jsdom":"^26.6.0","npm-run-all":"^4.1.5","rollup":"^2.32.1","rollup-plugin-sourcemaps":"^0.6.3","rollup-plugin-terser":"^7.0.2","ts-jest":"^26.4.1","tslint":"^6.1.3","typescript":"^4.0.3"},"engines":{"node":">= 10"},"gitHead":"8bf52d4d288825d292c0e0d25c46a5f734ba6700","bugs":{"url":"https://github.com/react-dropzone/file-selector/issues"},"_id":"file-selector@0.4.0","_nodeVersion":"14.18.3","_npmVersion":"6.14.15","dist":{"integrity":"sha512-iACCiXeMYOvZqlF1kTiYINzgepRBymz1wwjiuup9u9nayhb6g4fSwiyJ/6adli+EPwrWtpgQAh2PoS7HukEGEg==","shasum":"59ec4f27aa5baf0841e9c6385c8386bef4d18b17","tarball":"http://registry-npm.ywwl.com/file-selector/download/file-selector-0.4.0.tgz","fileCount":31,"unpackedSize":178459,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+dV+CRA9TVsSAnZWagAAzkUP/2bKLzHuO7bi6wszBLsS\n2FRiTjSQhlH7RLFdLHSpMHTNFo56TrzzrRnRqlVYt6+hQnAJfDmg/99Z3Rvi\nMGYjmRUeuySdCVORyZLxAEAn7rLZHmYSlvL0qvdC9TG2uH9+yi5v2oD4Sk3T\nJAVW0JR11L1gW3wLn2BscAXGwhQEMkuoHjolblDDzxANg1sssiCcPFjxqX3C\nx3q9OVvaRu78M3WdIGlFqRhh+ovh6z++fsr/5gwysBUzf8zUTo8joTl/7W70\nzOCejqtnsPZY63Pa2p+Nmj1DX3tG/Xs6x2un5OK2YQFeY/GcVuG24xe266SB\n+cJgYWuIkRtqDiEKEAaIcIyCdP0VwMsa7l0ldHKC30Y2/f6lpLVzmZ6oJJGu\n4064m5jBb3Nw/QCLzW8y75Lfg28OPoyCwfsn7FqkXpEWVtZUVCpqGU/YsYKl\nRQ2pkJGEqZHkguMomj4d4cEAwB/2GeIFDoMtuMJQbIugQzcW00dc1CSUIqnt\nDjJPGEmUAAxarhvECADOIiKiVTZfOb8uykfxcQ8F2bc1kvqjlCD5UyBFb+gO\n60pgOg2xK2NTK5S3UKL+tcetRZNPl0B0cOjE54GxhL5IJkvvy/gNAEeV+cjM\n2w92FQldKGd6YnKupQKeLnFUEdElJ3zJyVOhOnjGm6mtxZ32fzuyu/cT24x6\n1/ZT\r\n=EzMo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtfuJNjB+scS2lChaaEQHEmOHKnJyETMC45HzRd/06AwIhAIk8FgsrHMwDH81pIwdG00/cfoAl7uoOBDT963Rt44H/"}],"size":37669,"noattachment":false,"key":"/file-selector/-/file-selector-0.4.0.tgz"},"_npmUser":{"name":"rolandjitsu","email":"rolandjitsu@gmail.com"},"directories":{},"maintainers":[{"name":"rolandjitsu","email":"rolandjitsu@gmail.com"},{"name":"rxmarbles","email":"rmarkins@gmail.com"},{"name":"okonet","email":"andrey@okonet.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/file-selector_0.4.0_1643763070686_0.5108274845955372"},"_hasShrinkwrap":false,"readme":"# file-selector\n\n> A small package for converting a [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent) or [file input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file) to a list of File objects.\n\n[![npm](https://img.shields.io/npm/v/file-selector.svg?style=flat-square)](https://www.npmjs.com/package/file-selector)\n[![Tests](https://img.shields.io/github/workflow/status/react-dropzone/file-selector/Test?label=tests&style=flat-square)](https://github.com/react-dropzone/file-selector/actions?query=workflow%3ATest)\n[![codecov](https://img.shields.io/coveralls/github/react-dropzone/file-selector/master?style=flat-square)](https://coveralls.io/github/react-dropzone/file-selector?branch=master)\n[![Open Collective Backers](https://img.shields.io/opencollective/backers/react-dropzone.svg?style=flat-square)](#backers)\n[![Open Collective Sponsors](https://img.shields.io/opencollective/sponsors/react-dropzone.svg?style=flat-square)](#sponsors)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?style=flat-square)](https://github.com/react-dropzone/.github/blob/main/CODE_OF_CONDUCT.md)\n\n# Table of Contents\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [Browser Support](#browser-support)\n* [Contribute](#contribute)\n* [Credits](#credits)\n* [Support](#support)\n* [License](#license)\n\n\n## Installation\nYou can install this package from [NPM](https://www.npmjs.com):\n```bash\nnpm add file-selector\n```\n\nOr with [Yarn](https://yarnpkg.com/en):\n```bash\nyarn add file-selector\n```\n\n### CDN\nFor CDN, you can use [unpkg](https://unpkg.com):\n\n[https://unpkg.com/file-selector/dist/bundles/file-selector.umd.min.js](https://unpkg.com/file-selector/dist/bundles/file-selector.umd.min.js)\n\nThe global namespace for file-selector is `fileSelector`:\n```js\nconst {fromEvent} = fileSelector;\ndocument.addEventListener('drop', async evt => {\n    const files = await fromEvent(evt);\n    console.log(files);\n});\n```\n\n\n## Usage\n\n### ES6\nConvert a [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent) to File objects:\n```ts\nimport {fromEvent} from 'file-selector';\ndocument.addEventListener('drop', async evt => {\n    const files = await fromEvent(evt);\n    console.log(files);\n});\n```\n\nConvert a [change event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event) for an input type file to File objects:\n```ts\nimport {fromEvent} from 'file-selector';\nconst input = document.getElementById('myInput');\ninput.addEventListener('change', async evt => {\n    const files = await fromEvent(evt);\n    console.log(files);\n});\n```\n\nConvert [FileSystemFileHandle](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle) items to File objects:\n```ts\nimport {fromEvent} from 'file-selector';\n\n// Open file picker\nconst handles = await window.showOpenFilePicker({multiple: true});\n// Get the files\nconst files = await fromEvent(handles);\nconsole.log(files);\n```\n**NOTE** The above is experimental and subject to change.\n\n### CommonJS\nConvert a `DragEvent` to File objects:\n```ts\nconst {fromEvent} = require('file-selector');\ndocument.addEventListener('drop', async evt => {\n    const files = await fromEvent(evt);\n    console.log(files);\n});\n```\n\n\n## Browser Support\nMost browser support basic File selection with drag 'n' drop or file input:\n* [File API](https://developer.mozilla.org/en-US/docs/Web/API/File#Browser_compatibility)\n* [Drag Event](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent#Browser_compatibility)\n* [DataTransfer](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer#Browser_compatibility)\n* [`<input type=\"file\">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Browser_compatibility)\n\nFor folder drop we use the [FileSystem API](https://developer.mozilla.org/en-US/docs/Web/API/FileSystem) which has very limited support:\n* [DataTransferItem.getAsFile()](https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/getAsFile#Browser_compatibility)\n* [DataTransferItem.webkitGetAsEntry()](https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#Browser_compatibility)\n* [FileSystemEntry](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry#Browser_compatibility)\n* [FileSystemFileEntry.file()](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry/file#Browser_compatibility)\n* [FileSystemDirectoryEntry.createReader()](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader#Browser_compatibility)\n* [FileSystemDirectoryReader.readEntries()](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries#Browser_compatibility)\n\n\n## Contribute\nIf you wish to contribute, please use the following guidelines:\n* Use [Conventional Commits](https://conventionalcommits.org)\n* Use `[ci skip]` in commit messages to skip a build\n\n## Credits\n* [html5-file-selector](https://github.com/quarklemotion/html5-file-selector)\n\n## Support\n\n### Backers\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/react-dropzone#backer)]\n\n<a href=\"https://opencollective.com/react-dropzone/backer/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/9/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/backer/10/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/backer/10/avatar.svg\"></a>\n\n### Sponsors\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/react-dropzone#sponsor)]\n\n<a href=\"https://opencollective.com/react-dropzone/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/9/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-dropzone/sponsor/10/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-dropzone/sponsor/10/avatar.svg\"></a>\n\n## License\nMIT\n","publish_time":1643763070893,"_cnpm_publish_time":1643763070893,"dist-tags":{"beta":"3.0.0-beta.6","latest":"5.0.3","release-0.1.x":"0.1.19","release-1.2.x":"1.2.0","release-2.1.x":"2.1.2"}}