🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@types/file-saver

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/file-saver

TypeScript definitions for file-saver

2.0.7
ts4.5
ts4.6
ts4.7
ts4.8
ts4.9
ts5.0
ts5.1
ts5.2
ts5.3
ts5.4
ts5.5
ts5.6
ts5.7
ts5.8
ts5.9
latest
Source
npm
Version published
Weekly downloads
1.9M
3.03%
Maintainers
1
Weekly downloads
 
Created

What is @types/file-saver?

The @types/file-saver package provides TypeScript type definitions for the file-saver package, which is a JavaScript library that enables saving files on the client-side. It is useful for applications that need to generate and download files directly in the browser without sending them to a server first. The type definitions allow TypeScript developers to use file-saver with type checking and IntelliSense support in their IDEs.

What are @types/file-saver's main functionalities?

Saving text files

This feature allows you to save text files. The code sample demonstrates how to create a text file with the content 'Hello, world!' and save it as 'hello.txt'.

import { saveAs } from 'file-saver';
const data = new Blob(['Hello, world!'], { type: 'text/plain;charset=utf-8' });
saveAs(data, 'hello.txt');

Saving binary files

This feature allows you to save binary files. The code sample shows how to create a binary file from an array of bytes and save it as 'binaryFile.bin'.

import { saveAs } from 'file-saver';
const data = new Blob([new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f])], { type: 'application/octet-stream' });
saveAs(data, 'binaryFile.bin');

Other packages similar to @types/file-saver

FAQs

Package last updated on 07 Nov 2023

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