{"id":13438041,"url":"https://github.com/alnorris/file-dialog","last_synced_at":"2025-04-08T03:17:57.951Z","repository":{"id":45753537,"uuid":"83249700","full_name":"alnorris/file-dialog","owner":"alnorris","description":"Trigger the upload file dialog directly from your code easily.","archived":false,"fork":false,"pushed_at":"2024-09-28T11:37:52.000Z","size":17,"stargazers_count":59,"open_issues_count":6,"forks_count":12,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-04T09:45:14.577Z","etag":null,"topics":["dialog","file","fileapi","upload"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alnorris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-26T23:49:08.000Z","updated_at":"2025-01-19T13:12:26.000Z","dependencies_parsed_at":"2024-10-27T21:44:21.295Z","dependency_job_id":null,"html_url":"https://github.com/alnorris/file-dialog","commit_stats":{"total_commits":25,"total_committers":9,"mean_commits":"2.7777777777777777","dds":0.48,"last_synced_commit":"7cafc71d06db8999e493e57d548c91240cba6e9c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alnorris%2Ffile-dialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alnorris%2Ffile-dialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alnorris%2Ffile-dialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alnorris%2Ffile-dialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alnorris","download_url":"https://codeload.github.com/alnorris/file-dialog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767237,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dialog","file","fileapi","upload"],"created_at":"2024-07-31T03:01:02.424Z","updated_at":"2025-04-08T03:17:57.934Z","avatar_url":"https://github.com/alnorris.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# file-dialog\n\nNote: This project is deprecated, there is now a native browser api available, please use https://github.com/GoogleChromeLabs/browser-fs-access as a polyfill.\n\n\n[![npm version](https://img.shields.io/npm/v/file-dialog.svg?style=flat)](https://www.npmjs.com/package/file-dialog) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)\n\nDirectly call the file browser dialog from your code, and get back the resulting array of [FileList](https://developer.mozilla.org/en/docs/Web/API/FileList). Handy for when you need to post files via AJAX/Fetch. No more hacky hiding of `\u003cinput type=\"file\"\u003e` elements. Support for Callbacks \u0026 Promises! \n\n- Supports ES6 Modules, CommonJS, AMD, and global\n- Supports selecting multiple files and the file type 'accepts' attribute (see examples below)\n- Support for all major browsers\n- No jQuery needed, tiny (1.25 KB), with no dependencies\n\n![alt text](http://i.imgur.com/LjJlg7L.png \"Logo Title Text 1\")\n\n\n## Install\nSupports both CommonJS and ES6 Modules\n\n1. `npm install file-dialog`\n2. `import fileDialog from 'file-dialog'` or `const fileDialog = require('file-dialog')`\n\nNote: If you want to support older browsers make sure you have babel enabled.\n\n### Classic `\u003cscript\u003e` includes\n1. Include minified file-dialog.min.js via `\u003cscript\u003e`\n2. Module is binded to the global variable `fileDialog`\n\n\n## Examples\n\nGet a File via a promise and POST to server via Fetch\n\n```javascript\nfileDialog()\n    .then(file =\u003e {\n        const data = new FormData()\n        data.append('file', file[0])\n        data.append('imageName', 'flower')\n\n        // Post to server\n        fetch('/uploadImage', {\n            method: 'POST',\n            body: data\n        })\n    })\n```\n\nAllow user to select only an image file\n\n```javascript\nfileDialog({ accept: 'image/*' })\n    .then(files =\u003e {\n        // files contains an array of FileList\n    })\n```\n\nAllow user to select only images or videos\n```javascript\n    \nfileDialog({ accept: ['image/*', 'video/*'] })\n    .then(files =\u003e {\n        // files contains an array of FileList\n    })\n```\n\nAllow user to select multiple image files at once\n\n```javascript\nfileDialog({ multiple: true, accept: 'image/*' })\n    .then(files =\u003e {\n        // files contains an array of FileList\n    })\n```\n\nClassic callback version of the above\n\n```javascript\nfileDialog({ multiple: true, accept: 'image/*' }, files =\u003e {\n    // files contains an array of FileList\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falnorris%2Ffile-dialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falnorris%2Ffile-dialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falnorris%2Ffile-dialog/lists"}