![New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions](https://cdn.sanity.io/images/cgdhsj6q/production/86e6ebdea652d20da070ebbda20134b839972db7-1024x1024.webp?w=800&fit=max&auto=format)
Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
js-file-download
Advanced tools
Package description
The js-file-download npm package is a simple utility for triggering file downloads in the browser. It allows developers to programmatically download files of various types, such as text, JSON, CSV, and more, directly from the client-side JavaScript code.
Download Text File
This feature allows you to download a plain text file. The code sample demonstrates how to create a text file with the content 'Hello, world!' and trigger a download with the filename 'hello.txt'.
const fileDownload = require('js-file-download');
const text = 'Hello, world!';
fileDownload(text, 'hello.txt');
Download JSON File
This feature allows you to download a JSON file. The code sample shows how to convert a JavaScript object to a JSON string and trigger a download with the filename 'data.json'.
const fileDownload = require('js-file-download');
const jsonData = { name: 'John', age: 30 };
fileDownload(JSON.stringify(jsonData), 'data.json');
Download CSV File
This feature allows you to download a CSV file. The code sample demonstrates how to create a CSV string and trigger a download with the filename 'data.csv'.
const fileDownload = require('js-file-download');
const csvData = 'name,age\nJohn,30\nJane,25';
fileDownload(csvData, 'data.csv');
The file-saver package is a well-known library for saving files on the client-side. It provides similar functionality to js-file-download, allowing you to save text, JSON, CSV, and other types of files. It is widely used and has a larger community and more frequent updates compared to js-file-download.
The browser-filesaver package is another alternative for saving files in the browser. It offers similar capabilities to js-file-download, enabling the download of various file types. It is designed to be lightweight and easy to use, making it a good choice for simple file download tasks.
The downloadjs package is a utility for downloading files in the browser. It provides similar functionality to js-file-download, allowing you to trigger downloads of different file types. It is known for its simplicity and ease of integration into web applications.
Readme
Javascript function to trigger browser to save data to file as if it was downloaded.
npm install js-file-download --save
var fileDownload = require('js-file-download');
fileDownload(data, 'filename.csv');
FAQs
Javascript function that triggers browser to save javascript-generated content to a file
The npm package js-file-download receives a total of 421,263 weekly downloads. As such, js-file-download popularity was classified as popular.
We found that js-file-download demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.