Gathering detailed insights and metrics for file-selector
Gathering detailed insights and metrics for file-selector
Gathering detailed insights and metrics for file-selector
Gathering detailed insights and metrics for file-selector
Convert a DragEvent or file input to a list of File objects
npm install file-selector
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
95 Stars
85 Commits
33 Forks
4 Watching
6 Branches
12 Contributors
Updated on 27 Nov 2024
TypeScript (98.41%)
JavaScript (1.59%)
Cumulative downloads
Total Downloads
Last day
-2%
658,785
Compared to previous day
Last week
4.4%
3,382,903
Compared to previous week
Last month
12%
14,211,459
Compared to previous month
Last year
25.3%
149,457,750
Compared to previous year
A small package for converting a DragEvent or file input to a list of File objects.
You can install this package from NPM:
1npm add file-selector
For CDN, you can use unpkg:
https://unpkg.com/file-selector/dist/bundles/file-selector.umd.min.js
The global namespace for file-selector is fileSelector
:
1const {fromEvent} = fileSelector;
2document.addEventListener('drop', async evt => {
3 const files = await fromEvent(evt);
4 console.log(files);
5});
Convert a DragEvent to File objects:
1import {fromEvent} from 'file-selector'; 2document.addEventListener('drop', async evt => { 3 const files = await fromEvent(evt); 4 console.log(files); 5});
Convert a change event for an input type file to File objects:
1import {fromEvent} from 'file-selector'; 2const input = document.getElementById('myInput'); 3input.addEventListener('change', async evt => { 4 const files = await fromEvent(evt); 5 console.log(files); 6});
Convert FileSystemFileHandle items to File objects:
1import {fromEvent} from 'file-selector'; 2 3// Open file picker 4const handles = await window.showOpenFilePicker({multiple: true}); 5// Get the files 6const files = await fromEvent(handles); 7console.log(files);
NOTE The above is experimental and subject to change.
Convert a DragEvent
to File objects:
1const {fromEvent} = require('file-selector'); 2document.addEventListener('drop', async evt => { 3 const files = await fromEvent(evt); 4 console.log(files); 5});
Most browser support basic File selection with drag 'n' drop or file input:
For folder drop we use the FileSystem API which has very limited support:
Checkout the organization CONTRIBUTING.md.
Support us with a monthly donation and help us continue our activities. [Become a backer]
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
MIT
No vulnerabilities found.
Reason
23 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
Found 11/22 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
SAST tool is not run on all commits -- score normalized to 2
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More