{"id":15699601,"url":"https://github.com/yields/download","last_synced_at":"2025-04-16T00:45:58.507Z","repository":{"id":8153062,"uuid":"9573313","full_name":"yields/download","owner":"yields","description":"download files with `xhr`, report progress and send the file.","archived":false,"fork":false,"pushed_at":"2013-04-21T01:34:11.000Z","size":108,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T03:12:46.214Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yields.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-21T01:32:13.000Z","updated_at":"2017-07-06T04:14:48.000Z","dependencies_parsed_at":"2022-08-23T22:40:08.454Z","dependency_job_id":null,"html_url":"https://github.com/yields/download","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdownload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdownload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdownload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yields%2Fdownload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yields","download_url":"https://codeload.github.com/yields/download/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249177960,"owners_count":21225346,"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":[],"created_at":"2024-10-03T19:41:04.878Z","updated_at":"2025-04-16T00:45:58.473Z","avatar_url":"https://github.com/yields.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# download\n\n  Downloads a file with `xhr`, report progress and send the file to the user.\n\n## Installation\n\n    $ component install yields/download\n\n## Example\n\nYou can run the example with `$ make example` and then `$ serve . \u0026\u0026 open http://localhost:300/`.\n\n```js\nvar Download = require('download')\n  , Progress = require('progress');\n\nvar download = new Download('somefile');\nvar progress = new Progress();\ndoument.body.appendChild(progress.el);\nprogress.update(0);\n\ndownload.on('progress', function(e){\n  progress.update(e.percent);\n});\n\ndownload.end(function(err, req){\n  if (err) throw err;\n  location.pathname = '/somefile';\n});\n```\n\n## API\n\n### Download(filepath)\n\nCreate a new Download with `filepath`.\n\n### download.abort()\n\nAbort the request.\n\n### download.end(fn(err, req))\n\nStart the download and invoke `fn(err, req)`, at this point you should just do `location.pathname = '/somefile'`.\n\n## dependencies\n\n  - [yields/xhr](https://github.com/yields/xhr)\n  - [component/emitter](https://github.com/component/emitter)\n\n## License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyields%2Fdownload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyields%2Fdownload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyields%2Fdownload/lists"}