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

xave

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xave

📦 Tiny tool to save stuff similar to the saveAs dialog

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Xave - HTML5 JS SaveAs tool

A tiny ~.5kb tool to save stuff. It opens a saveAs like dialog on browser.

Size Example

yarn add xave
npm install xave

Usage

The xave function accepts 2 arguments. First argument is an url string, Blob or Blob URI, second one is the "name.extension" string of the file you want to save.

xave(Blob|URL|URI, "name.extension")

import save from "xave"
// Or
const save = require("xave")

const blob = new Blob(["xd"], { type: "text/plain" })
save(blob, "text.txt")
const save = require("xave")

//PDF
const blob = new Blob(["someencodedcontent"], { type: "application/pdf" })
save(blob, "report.pdf")

//images
const image = new Blob(["someencodedcontent"], { type: "image/png" })
save(image, "image.png")

//Canvas
const canvas = window.canvas
const ctx = canvas.getContext("2d")
ctx.fillStyle = "red"
ctx.beginPath()
ctx.arc(15, 15, 15, 0, Math.PI * 2, true)
ctx.closePath()
ctx.fill()
const url = canvas.toDataURL()
save(url)

CDN

<script src="https://d3portillo.github.io/xave/src/index.min.js"></script>

Playground and More

  • Observable
  • Source

Keywords

FAQs

Package last updated on 17 Oct 2020

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