{"id":19555019,"url":"https://github.com/kanety/stimulus-uploader","last_synced_at":"2025-07-31T00:03:20.292Z","repository":{"id":57702423,"uuid":"417757920","full_name":"kanety/stimulus-uploader","owner":"kanety","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-16T08:28:56.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T21:38:18.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kanety.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-16T07:50:15.000Z","updated_at":"2021-10-16T08:28:59.000Z","dependencies_parsed_at":"2022-09-26T21:11:17.640Z","dependency_job_id":null,"html_url":"https://github.com/kanety/stimulus-uploader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kanety/stimulus-uploader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanety%2Fstimulus-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanety%2Fstimulus-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanety%2Fstimulus-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanety%2Fstimulus-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanety","download_url":"https://codeload.github.com/kanety/stimulus-uploader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanety%2Fstimulus-uploader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267961967,"owners_count":24172531,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T04:31:01.953Z","updated_at":"2025-07-31T00:03:20.272Z","avatar_url":"https://github.com/kanety.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stimulus-uploader\n\nA stimulus controller for simple file uploader.\n\n## Dependencies\n\n* @hotwired/stimulus 3.0\n\n## Installation\n\nInstall from npm:\n\n    $ npm install @kanety/stimulus-uploader --save\n\n## Usage\n\nRegister controller:\n\n```javascript\nimport { Application } from '@hotwired/stimulus';\nimport UploaderController from '@kanety/stimulus-uploader';\n\nconst application = Application.start();\napplication.register('uploader', UploaderController);\n```\n\nImport css:\n\n```css\n@import '@kanety/stimulus-uploader';\n```\n\nBuild html as follows:\n\n```html\n\u003cdiv data-controller=\"uploader\"\n     data-uploader-url-value=\"YOUR_BACKEND_URL\"\u003e\n  \u003cinput type=\"file\" name=\"file\" multiple=\"true\"\u003e\n\u003c/div\u003e\n```\n\n### Optional targets\n\n#### progress\n\nYou can specify element to show progress message as follows:\n\n```html\n\u003cdiv class=\"st-uploader\"\n     data-controller=\"uploader\"\n     data-uploader-url-value=\"YOUR_BACKEND_URL\"\u003e\n  \u003cinput type=\"file\" name=\"file\" multiple=\"true\"\u003e\n  \u003cdiv class=\"st-uploader__progress\" data-uploader-target=\"progress\"\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Options\n\n#### params\n\nSet additional query parameters:\n\n```html\n\u003cdiv data-controller=\"uploader\"\n     data-uploader-params-value='{\"key\":\"value\"}'\u003e\n\u003c/div\u003e\n```\n\nYou can also set global query parameters as follows:\n\n```javascript\nimport UploaderController from '@kanety/stimulus-uploader';\n// set by object\nUploaderController.params = { key: 'value' };\n// set by function\nUploaderController.params = () =\u003e {\n  return { key: \"value\" };\n}\n```\n\n#### fetch-options\n\nSet additional fetch options recognized by fetch API:\n\n```html\n\u003cdiv data-controller=\"uploader\"\n     data-uploader-fetch-options-value='{\"key\":\"value\"}'\u003e\n\u003c/div\u003e\n```\n\nYou can also set global options as follows:\n\n```javascript\nimport UploaderController from '@kanety/stimulus-uploader';\nUploaderController.fetchOptions = { key: 'value' };\n```\n\n### Callbacks\n\nRun callbacks when files are uploaded or failed:\n\n```javascript\nlet element = document.querySelector('[data-controller=\"uploader\"]');\nelement.addEventListener('uploader:before', e =\u003e {\n  console.log(e.detail.files);\n});\nelement.addEventListener('uploader:start', e =\u003e {\n  console.log(e.detail.index + \":\" + e.detail.file);\n});\nelement.addEventListener('uploader:done', e =\u003e {\n  console.log(e.detail.index + \":\" + e.detail.file);\n});\nelement.addEventListener('uploader:fail', e =\u003e {\n  console.log(e.detail.index + \":\" + e.detail.file);\n});\nelement.addEventListener('uploader:end', e =\u003e {\n  console.log(e.detail.index + \":\" + e.detail.file);\n});\nelement.addEventListener('uploader:after', e =\u003e {\n  console.log(e.detail.files);\n});\n```\n\n## License\n\nThe library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanety%2Fstimulus-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanety%2Fstimulus-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanety%2Fstimulus-uploader/lists"}