Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

file64

encrypit10.2kMIT1.0.4TypeScript support: included

Convert Base64 to Blob/File and Blob/File to Base64.

base64, base64-to-blob, base64-to-file, blob, blob-to-base64, decode, encode, file, file-to-base64

readme

file64

NPM

NPM version build codecov

Convert Base64 to Blob/File and Blob/File to Base64.

Installation

NPM:

npm install file64

Yarn:

yarn add file64

Usage

Convert Base64 to Blob:

import { base64ToBlob } from 'file64';

const blob = await base64ToBlob('data:text/plain;base64,YQ==');

Convert Base64 to File:

import { base64ToFile } from 'file64';

const file = await base64ToFile('data:text/plain;base64,YQ==', 'file.txt');

Convert Blob to Base64:

import { blobToBase64 } from 'file64';

const blob = new Blob(['a'], { type: 'text/plain' });
const base64 = await blobToBase64(blob);

Convert File to Base64:

import { fileToBase64 } from 'file64';

const file = new File(['a'], 'file.txt', { type: 'text/plain' });
const base64 = await fileToBase64(file);

Release

Release is automated with Release Please.

License

MIT

changelog

Changelog

1.0.4 (2024-09-05)

Continuous Integration

  • github: publish package to npm registry with provenance (e526db7)

1.0.3 (2023-10-29)

Build System

  • package: specify "types", remove "esm/" dir, & add "src/" to files (4fc58c3)

1.0.2 (2023-07-12)

Build System

  • rename directory module to esm (a066d72)

1.0.1 (2023-06-25)

Bug Fixes

  • module: export modules explicitly (5295a84)

1.0.0 (2023-06-25)

Features

  • add base64ToBlob, base64ToFile, blobToBase64, and fileToBase64 (1ca17ec)