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

save-as-file

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

save-as-file

A simple fn to save a file to disk

  • 0.1.1
  • npm
  • Socket score

Version published
Weekly downloads
174
increased by31.82%
Maintainers
1
Weekly downloads
 
Created
Source

File Saver

A simple fn to save a file to disk.

Travis (.org) branch

Table of Contents

Installation


You can install this package from NPM:

npm add save-as-file

Or with Yarn:

yarn add save-as-file
CDN

For CDN, you can use unpkg:

https://unpkg.com/save-as-file/dist/bundles/save-as-file.umd.min.js

The global namespace for save-as-file is saveAsFile:

const json = JSON.stringify({ping: true});
const file = new File([json], {type: 'application/json'});
saveAsFile(file, 'test.json');

Usage


ES6

Save a File to disk:

import saveFile from 'save-as-file';
const json = JSON.stringify({ping: true});
const file = new File([json], {type: 'application/json'});
saveFile(file, 'test.json');
CommonJS

Save a File to disk:

const saveFile = require('save-as-file');
const json = JSON.stringify({ping: true});
const file = new File([json], {type: 'application/json'});
saveFile(file, 'test.json');

Browser Support


You can expect this lib to run wherever the href download attribute is supported.

Contribute


If you wish to contribute, please use the following guidelines:

Keywords

FAQs

Package last updated on 05 Sep 2018

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