{"id":23341788,"url":"https://github.com/mtillmann/file-ingest","last_synced_at":"2026-02-13T07:07:59.159Z","repository":{"id":268263104,"uuid":"903817563","full_name":"Mtillmann/file-ingest","owner":"Mtillmann","description":"simple file ingest for the browser","archived":false,"fork":false,"pushed_at":"2024-12-15T16:29:03.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T14:40:07.998Z","etag":null,"topics":["copy-paste","drag-and-drop","file-input","files"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Mtillmann.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":"2024-12-15T16:27:28.000Z","updated_at":"2024-12-15T16:30:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"d1b8934c-ac97-4ad1-bc48-605f0804adad","html_url":"https://github.com/Mtillmann/file-ingest","commit_stats":null,"previous_names":["mtillmann/file-ingest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mtillmann/file-ingest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mtillmann%2Ffile-ingest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mtillmann%2Ffile-ingest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mtillmann%2Ffile-ingest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mtillmann%2Ffile-ingest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mtillmann","download_url":"https://codeload.github.com/Mtillmann/file-ingest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mtillmann%2Ffile-ingest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29398158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["copy-paste","drag-and-drop","file-input","files"],"created_at":"2024-12-21T05:11:56.383Z","updated_at":"2026-02-13T07:07:59.145Z","avatar_url":"https://github.com/Mtillmann.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Ingest\n\nA simple class to ingest [files](https://developer.mozilla.org/en-US/docs/Web/API/File) in the browser by drag and drop, copy and paste or file input.\n\n## Usage\n\nInstall the package:\n\n```bash\nnpm install @mtillmann/file-ingest\n```\n\nAfter creating an instance, you'll receive a custom event `file-ingest:files` on the target element with the files as `event.detail.files`. \n\n- `event.detail.files` contains an array of files that passed the `accept`-option's MIME type check. \n- Set the `includeRejectedFiles`-option to `true` to include rejected files in `event.detail.rejected`. \n- If you set the `emitWhenEmpty`-option to `true`, the event will be emitted even when no matched files are present.\n\n### Bundler\n\n```javascript\nimport FileIngest from '@mtillmann/file-ingest';\n\nconst fileIngest = new FileIngest();\n\ndocument.documentElement.addEventListener('file-ingest:files', (event) =\u003e {\n  console.log(event.detail.files);\n});\n```\n\n### Module Script Tag\n\n```html\n\u003cscript type=\"module\"\u003e\n  import FileIngest from '.../@mtillmann/file-ingest/dist/index.js';\n\n  const fileIngest = new FileIngest();\n\n  document.documentElement.addEventListener('file-ingest:files', (event) =\u003e {\n    console.log(event.detail.files);\n  });\n\u003c/script\u003e\n```\n\n### Classic Script Tag\n\n```html\n\u003cscript src=\".../@mtillmann/file-ingest/dist/index.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const fileIngest = new FileIngest();\n\n  document.documentElement.addEventListener('file-ingest:files', (event) =\u003e {\n    console.log(event.detail.files);\n  });\n\u003c/script\u003e\n```\n\n\n\n## Options\n\n| Option | Type | Default | Description |\n| --- | --- | --- | --- |\n| target | `String\\|HTMLElement` | `document.documentElement` | Element or Selector String to attach the events to |\n| accept | `string` | `*/*` | List of MIME types that are accepted by the instance. Supports wildcard subtypes (e.g. `image/*`) |\n| paste | `boolean` | `true` | Enable or disable paste events |\n| drop | `boolean` | `true` | Enable or disable drop events |\n| change | `boolean` | `true` | Enable or disable change-events on `[type=file]`-inputs |\n| preventDefault | `boolean` | `true` | Prevent the default behavior of the events |\n| dragClasses | `Record\\\u003cstring, string \\| string[]\\\u003e` | `...` | Classes to add and remove on drag events |\n| applyDragClasses | `boolean` | `true` | Apply drag classes to the target element |\n| ignorePasteOnInput | `boolean` | `true` | Ignore paste events on input, textarea and `[contenteditable=true]`-elements |\n| eventPrefix | `string` | `file-ingest` | Prefix for the custom events |\n| eventTarget | `String\\|HTMLElement` | `options.target` | Element to dispatch the custom events on |\n| callback | `Function` | `null` | Callback function to call in addition to events - receives the content of `event.detail` as argument |\n| includeRejectedFiles | `boolean` | `false` | Include rejected files in the event detail - useful for error messages etc. |\n| emitWhenEmpty | `boolean` | `false` | Emit event even when no (matched) files are present |\n\n\n## API\n\n### `destroy()`\n\nRemoves all event listeners and cleans up the instance.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtillmann%2Ffile-ingest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtillmann%2Ffile-ingest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtillmann%2Ffile-ingest/lists"}