{"id":15440740,"url":"https://github.com/jonluca/browser-file-download","last_synced_at":"2025-04-04T23:12:21.487Z","repository":{"id":57746225,"uuid":"520295967","full_name":"jonluca/browser-file-download","owner":"jonluca","description":"Download files using this package","archived":false,"fork":false,"pushed_at":"2022-08-02T02:10:43.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T01:37:44.029Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jonluca.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}},"created_at":"2022-08-02T00:02:56.000Z","updated_at":"2022-08-02T02:06:42.000Z","dependencies_parsed_at":"2022-09-01T19:30:25.561Z","dependency_job_id":null,"html_url":"https://github.com/jonluca/browser-file-download","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonluca%2Fbrowser-file-download","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonluca%2Fbrowser-file-download/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonluca%2Fbrowser-file-download/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonluca%2Fbrowser-file-download/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonluca","download_url":"https://codeload.github.com/jonluca/browser-file-download/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261605,"owners_count":20910108,"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-01T19:15:10.572Z","updated_at":"2025-04-04T23:12:21.471Z","avatar_url":"https://github.com/jonluca.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Browser File Download\n\nDownload files with javascript\n\n```javascript\nimport axios from \"axios\";\nimport { download } from \"browser-file-downloader\";\n\nconst download = async (url: string, filename: string) =\u003e {\n  const { data } = await axios.get(url, {\n    responseType: \"blob\",\n  });\n  download(data, { filename });\n};\n```\n\n## Options\n\n```typescript\ninterface DownloadOptions {\n  filename: string; // filename\n  mime?: string; // mime time (default: application/octet-stream) - required when using useDataUrl\n  bom?: BlobPart; // bom (bytes to include at the start of the file)\n  useDataUrl?: boolean; // whether to use the legacy data url instead of a blob url\n}\n```\n\n## Examples\n\n#### CSV\n\nIf your CSVs are looking weird, you can try\n\n```typescript\nimport { download } from \"browser-file-downloader\";\n\nlet csvString = \"\";\nconst bom = \"\\uFEFF\";\n\ndownload(csvString, { filename: \"data.csv\", bom, useDataUrl: true, mime: \"text/csv; charset=utf-8\" });\n```\n\n### Legacy\n\n```javascript\nconst download = require(\"browser-file-downloader/dist/cjs/index.legacy.js\");\n\ndownload(\"My data\", { filename: \"file.txt\" });\n```\n\n### Modern ESM\n\n```javascript\nimport { download } from \"browser-file-downloader/dist/mjs/index.modern.js\";\n\ndownload(\"My data\", { filename: \"file.txt\" });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonluca%2Fbrowser-file-download","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonluca%2Fbrowser-file-download","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonluca%2Fbrowser-file-download/lists"}