Js File Download
js-file-download
Javascript function that triggers browser to save javascript-generated content to a file
Utilities
javascript
file
react
download
js-file-download
Utilities
npm
frontend
open source
ui
Stars
919
Weekly
715k
Open issues
11
Bundle
~25 kB
Installation
npm install js-file-downloadCode example
import { useJsFileDownload } from "js-file-download";
export function Example() {
const value = useJsFileDownload();
return <p>{String(value)}</p>;
}Pros & cons
Pros
- Actively maintained by Kenneth Jiang
- 715k weekly downloads. Battle tested
- First-class TypeScript definitions
- MIT licensed
Considerations
- Adds roughly ~25 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 11 open issues on GitHub