1.0.4 • Published 8 months ago

fitool v1.0.4

Weekly downloads
2
License
BSD-3-Clause-Clea...
Repository
github
Last release
8 months ago
npm install fitool
# or:
yarn add fitool

Table of contents

  1. Examples
  2. Usage

Examples

Convert text/plain data URL to string

import { download } from 'fitool';

async function example() {
  const result = await toString('data:text/plain,abc');
  // result = abc
}

Download data URL

import { download } from 'fitool';

async function example() {
  await download('data:image/png;base64,...');
}

Usage

toFile(file: File | Blob | string | ArrayBuffer, name?: string): Promise\<File>

Converts a given File, Blob, ArrayBuffer, data URL, blob URL or string to a File.

toBlob(file: File | Blob | string | ArrayBuffer): Promise\<Blob>

Converts a given File, Blob, ArrayBuffer, data URL, blob URL or string to a Blob.

toDataURL(file: File | Blob | string | ArrayBuffer): Promise\<string>

Converts a given File, Blob, ArrayBuffer, data URL, blob URL or string to a data URL.

toBlobURL(file: File | Blob | string | ArrayBuffer): Promise\<string>

Converts a given File, Blob, ArrayBuffer, data URL, blob URL or string to a blob URL.

toArrayBuffer(file: File | Blob | string | ArrayBuffer): Promise\<ArrayBuffer>

Converts a given File, Blob, ArrayBuffer, data URL, blob URL or string to an ArrayBuffer.

toString(file: File | Blob | string | ArrayBuffer): Promise\<string>

Converts a given File, Blob, ArrayBuffer, data URL, blob URL or string to an UTF-8 string.

download(file: File | Blob | string | ArrayBuffer, name: string): Promise\<void>

Initiates a download for a given File, Blob, ArrayBuffer, data URL, blob URL or string.

1.0.4

8 months ago

1.0.3

1 year ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago