![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
js-file-download
Advanced tools
Javascript function that triggers browser to save javascript-generated content to a file
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.
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 0 weekly downloads. As such, js-file-download popularity was classified as not 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.