whatisgithub

What is filesaver.js?

eligrey/filesaver.js — explained in plain English

Analysis updated 2026-06-21

22,004JavaScriptAudience · developerComplexity · 1/5Setup · easy

In one sentence

FileSaver.js is a tiny JavaScript library that lets web apps trigger file downloads in the browser using a simple saveAs() function, no server needed for files generated entirely on the client side.

Mindmap

mindmap
  root((FileSaver.js))
    What it does
      Browser file download
      No server needed
      saveAs function
    Data Types
      Text files
      CSV spreadsheets
      Canvas images
    How it works
      Creates a Blob
      Triggers download
    Limitations
      Memory-bound
      StreamSaver for large files
    Audience
      Web developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Export a table from a web app as a downloadable CSV file that the user can save with one click.

USE CASE 2

Let users save a drawing from an HTML canvas element as a PNG image file directly from the browser.

USE CASE 3

Download a text report generated from a form submission without sending any data to a server first.

What is it built with?

JavaScriptTypeScriptnpm

How does it compare?

eligrey/filesaver.jschenglou/react-motiondocmirror/dev-sidecar
Stars22,00421,92522,092
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity1/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

For files larger than available browser memory, use the companion StreamSaver.js library instead.

So what is it?

FileSaver.js is a JavaScript library that lets web applications trigger file downloads directly in the browser, without needing a server to send the file. It provides a simple saveAs() function that you call with the data you want to save and a filename, and the browser presents the user with a download. The problem it solves is that web pages run inside a browser sandbox and cannot directly write to a user's file system. FileSaver.js works around this by creating a "Blob", a browser-native object that holds arbitrary data in memory, and then triggering a download of that Blob. This makes it useful for web apps that generate content on the fly: for example, exporting a spreadsheet that was assembled in the browser, downloading a text file generated from a form, or saving an image that was drawn on an HTML canvas element. You would use it when you are building a web app that needs to let users download files that were created or assembled entirely in the browser, rather than fetched from a server. Common scenarios include data export, report generation, and canvas image saving. If your files come from a server, the README recommends using a standard server-side HTTP header instead, which has broader browser compatibility. The library supports a wide range of browsers. For very large files that exceed browser memory limits, the README points to a companion project called StreamSaver.js that writes directly to disk using streaming. FileSaver.js is installed via npm and is written in JavaScript with optional TypeScript type definitions available.

Copy-paste prompts

Prompt 1
Using FileSaver.js, write a function that exports the contents of a JavaScript array as a downloadable CSV file when a button is clicked.
Prompt 2
How do I use FileSaver.js with an HTML canvas element to let users save their drawing as a PNG?
Prompt 3
I am generating a PDF in the browser with pdf-lib. Show me how to trigger a file download using FileSaver.js saveAs().

Frequently asked questions

What is filesaver.js?

FileSaver.js is a tiny JavaScript library that lets web apps trigger file downloads in the browser using a simple saveAs() function, no server needed for files generated entirely on the client side.

What language is filesaver.js written in?

Mainly JavaScript. The stack also includes JavaScript, TypeScript, npm.

How hard is filesaver.js to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is filesaver.js for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.