Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

downloadjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downloadjs

file downloading using client-side javascript

  • 1.4.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created

What is downloadjs?

The downloadjs npm package is a simple utility for triggering file downloads in the browser. It allows you to programmatically download files of various types, such as text, images, and binary data, directly from JavaScript.

What are downloadjs's main functionalities?

Download Text Files

This feature allows you to download text content as a file. The code sample demonstrates how to create a text file named 'hello.txt' with the content 'Hello, world!' and trigger its download.

const download = require('downloadjs');
const text = 'Hello, world!';
download(text, 'hello.txt', 'text/plain');

Download Images

This feature allows you to download images. The code sample fetches an image from a URL, converts it to a Blob, and triggers its download as 'image.png'.

const download = require('downloadjs');
const imageUrl = 'https://example.com/image.png';
fetch(imageUrl)
  .then(response => response.blob())
  .then(blob => download(blob, 'image.png', 'image/png'));

Download Binary Data

This feature allows you to download binary data. The code sample demonstrates how to create a binary file named 'binary.bin' with some sample binary data and trigger its download.

const download = require('downloadjs');
const binaryData = new Uint8Array([0x00, 0x01, 0x02, 0x03]);
download(binaryData, 'binary.bin', 'application/octet-stream');

Other packages similar to downloadjs

Keywords

FAQs

Package last updated on 22 May 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc