Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danieljdufour/easy-file-saver
Very Easily Save a File
https://github.com/danieljdufour/easy-file-saver
csv data download file file-saver javascript js json save
Last synced: about 1 month ago
JSON representation
Very Easily Save a File
- Host: GitHub
- URL: https://github.com/danieljdufour/easy-file-saver
- Owner: DanielJDufour
- License: cc0-1.0
- Created: 2020-11-19T23:59:47.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-31T19:56:27.000Z (over 1 year ago)
- Last Synced: 2024-12-06T15:51:51.580Z (2 months ago)
- Topics: csv, data, download, file, file-saver, javascript, js, json, save
- Language: JavaScript
- Homepage: https://danieljdufour.com/easy-file-saver/
- Size: 514 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easy-file-saver
Very Easily Save a File# demo
https://danieljdufour.com/easy-file-saver/# install
```bash
npm install easy-file-saver
```
or
```html```
# usage
```js
const saveFile = require("easy-file-saver");const countries = [
{ name: "United States of America", abbreviation: "USA" },
{ name: "Canada", abbreviation: "CA" },
{ name: "Mexico", abbreviation: "MX" }
];
saveFile({ data: countries, debug: true, filename: "countries.csv" });
saveFile({ data: countries, debug: true, filename: "countries.tsv" });
saveFile({ data: countries, debug: true, filename: "countries.json" });
saveFile({ data: countries.map(c => `${c.name} (${c.abbreviation})`).join("\n"), debug: true, filename: "countries.txt" });
```# features
saveFile supports the following conversions:
| data source | output formats |
| ---------------- | -------------- |
| ArrayBuffer | .csv, .jpg, .json, .html, .pdf, .png, .tsv, .txt, .webp |
| Array of Arrays | .csv, .json, .tsv |
| Array of Objects | .csv, .json, .tsv |
| Blob | .csv, .jpg, .json, .html, .png, .tsv, .txt, .webp |
| Canvas | .jpg, .png, .webp |
| Data URL | .csv, .jpg, .json, .html, .png, .tsv, .txt, .webp |
| File | .csv, .jpg, .json, .html, .png, .tsv, .txt, .webp |
| HTML Element | .html |
| Image | .jpg, .png, .webp |
| Object | .json |
| String | .html, .js, .py, .txt |
| Uint8Array | .csv, .jpg, .json, .html, .pdf, .png, .tsv, .txt, .webp |# any formats missing?
Post an issue at https://github.com/DanielJDufour/easy-file-saver or submit a Pull Request!