download

Trigger client-side file downloads from JavaScript using strings, Blobs, data URLs, or typed arrays, with no server round trip required.

Library
npm
v1.4.7
2,329stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
46/100Fair
Development Activity0
Maintenance20
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
45/100Fair
Architecture55
Code Quality25
Innovation55
Learning Curve45

download (published to npm as downloadjs) is a single-function browser library that saves data to the user’s local filesystem entirely from client-side JavaScript. Call download(data, fileName, mimeType) with a URL, plain string, Blob, typed array, or base64/URI-encoded data URL, and it normalizes the input into a Blob and drives the browser’s native save dialog — no backend endpoint or Content-Disposition header needed.

Under the hood it picks the best available mechanism for the current browser: the HTML5 a[download] attribute where supported, navigator.msSaveBlob for older IE, a popup/confirm() fallback for Safari, and a hidden iframe for legacy engines that support neither. It ships as a UMD module, so it works equally as a CommonJS require, an AMD module, or a plain <script> global, and it has zero runtime dependencies.

What You Get

  • A single download(data, fileName, mimeType) function that accepts five different input shapes without requiring the caller to branch on type
  • Automatic browser-capability detection that picks a[download], msSaveBlob, a Safari popup fallback, or a hidden iframe as needed
  • UMD packaging that works as a CommonJS require, an AMD module, or a global <script> include
  • Built-in handling for large (>2MB) data URLs by converting them to Blobs instead of holding them as strings
  • A minified download.min.js build shipped directly in the package for CDN/script-tag use

Common Use Cases

  • Exporting client-generated reports, CSVs, or JSON as downloadable files without hitting a server endpoint
  • Offering a ‘Save as’ action for canvas/image data or ajax response blobs
  • Downloading a same-origin file (e.g. /robots.txt or an image) via a single URL argument
  • Wiring an ajax success callback directly to a download via download.bind(true, mimeType, fileName)

Under The Hood

Architecture The entire library is one exported UMD function (download.js), a monolith by design given its narrow scope: it normalizes the incoming data argument (a same-origin URL, plain string, data URL, Blob, or typed array) into a Blob, then delegates to an internal saver() closure that branches on browser capability — the HTML5 a[download] attribute, navigator.msSaveBlob for older IE, a window.open/confirm() fallback for Safari, or a hidden iframe for legacy engines lacking both. A nested dataUrlToBlob() helper decodes base64 or URI-encoded data URL payloads into a Uint8Array for the Blob constructor. There’s no dependency injection or external state; the whole data flow is a synchronous input-transform followed by a browser-specific save trigger, and the saver fallback chain is the one abstraction any behavior change would have to touch.

Tech Stack Zero runtime dependencies — pure vanilla JavaScript targeting browser globals (window, Blob, XMLHttpRequest, FileReader, navigator.msSaveBlob) wrapped in a UMD shim supporting AMD (RequireJS), CommonJS (module.exports), and direct global-script consumption. The repo ships a pre-minified download.min.js alongside the source with no visible bundler config or lockfile, and is distributed through both npm (as downloadjs) and Bower, with mirrors on cdnjs and unpkg for <script>-tag use.

Code Quality No test directory, test framework, or CI workflow is present in the repository; correctness appears to rely on the manually-linked live demo pages referenced throughout the README rather than an automated suite. Error handling is minimal — a try/catch around self.btoa() falls back to encodeURIComponent, but most browser-capability failures (like a blocked Safari popup) surface through confirm() prompts rather than thrown or returned errors. Variable naming favors minimal-size minification-friendly names (a, b, mx, f) over readability, and there’s no TypeScript, JSDoc typing, or linter/formatter configuration in the repo.

API Design The public surface is a single call, download(data, fileName, mimeType), that accepts five different input shapes (URL, string, data URL, Blob, typed array) without requiring the caller to branch on type first, which is the library’s main ergonomic strength. The README is unusually thorough for a project this small — it documents every parameter and links a live demo for each input type plus a compatibility/FAQ section — but no TypeScript type definitions ship with the package or are referenced on DefinitelyTyped, so consumers get no editor autocomplete for the function signature.

Used by 7 apps in this directory

TypeScript
68%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,825

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
TypeScript68%
Java21%
Updated 3 days ago
TypeScript
69%
Other

Budibase

Low Code Platforms · No Code Platforms

28,260

Build AI agents, automations, and internal apps on a single open-source platform with full self-hosting control.

View details
91
Repo Health
81
Technical
63
Dependency
Built with
TypeScript69%
Svelte26%
Updated 2 days ago
Go
52%
MIT

Bytebase

Devops

14,467

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

View details
92
Repo Health
73
Technical
68
Dependency
Built with
Go52%
TypeScript39%
Updated yesterday
Java
48%
Apache 2.0

ClearFlask

Product Management · Community

451

Open-source feedback management and roadmap tool that lets product teams collect, prioritize, and respond to user input — with AI-powered summarization and full self-hosting control.

View details
82
Repo Health
73
Technical
62
Dependency
Built with
Java48%
TypeScript47%
Updated 4 days ago
TypeScript
82%
MIT

evidence

Analytics · Data Engineering

6,911

Turn SQL queries and markdown files into polished, interactive data apps and business intelligence reports — no drag-and-drop, no GUI, just code.

View details
87
Repo Health
79
Technical
64
Dependency
Built with
TypeScript82%
Svelte18%
Updated 3 days ago
TypeScript
100%
Apache 2.0

ILLA Builder

Developer Tools · Low Code Platforms · No Code Platforms

12,312

Open-source low-code platform for building internal tools with drag-and-drop UI, reactive data bindings, and real-time collaboration.

View details
57
Repo Health
71
Technical
63
Dependency
Built with
TypeScript100%
Updated 3 months ago
TypeScript
81%
MIT

LibreChat

Developer Tools · AI Assistants

42,871

Unite every major AI model in one self-hosted chat platform with agents, code execution, MCP tools, and enterprise authentication.

View details
93
Repo Health
81
Technical
65
Dependency
Built with
TypeScript81%
JavaScript18%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search