Options
All
  • Public
  • Public/Protected
  • All
Menu

@bytesoftio/helpers-file

Installation

yarn add @bytesoftio/helpers-file or npm install @bytesoftio/helpers-file

Table of contents

Description

Collection of file related helpers.

Usage

downloadAsFile

Download any kind of data as a file (works only in browser).

import { downloadAsFile } from "@bytesoftio/helpers-file"

const fileName = "data.csv"
const data = "name,age\nJohn,30\nSnow,40"

downloadAsFile(fileName, data)

Index

Functions

Functions

Const downloadAsFile

  • downloadAsFile(fileName: string, data: string | ArrayBufferView | ArrayBuffer | Blob | (string | ArrayBufferView | ArrayBuffer | Blob)[], contentType?: undefined | string): void
  • Parameters

    • fileName: string
    • data: string | ArrayBufferView | ArrayBuffer | Blob | (string | ArrayBufferView | ArrayBuffer | Blob)[]
    • Default value contentType: undefined | string = "application/octet-stream"

    Returns void