1.0.2 • Published 6 years ago

promise-base64 v1.0.2

Weekly downloads
10
License
MIT
Repository
github
Last release
6 years ago
  • Encode a file to a base64 string using promise
  • Decode a base64 string to a file using promise

Install

$ npm install promise-base64 --save

Usage

Encode

var base64 = require('promise-base64');

base64.encode('./text.txt')
.then((base64String) => {
    console.log(base64String)
})
.catch((err) => {
    console.log(err)
})

Or using await

const base64String = await base64.encode('./text.txt')

Decode

var base64String = 'swesh523sfsfgwg';
base64.decode(base64String, 'text.new.txt')
.then((base64String) => {
    console.log(base64String)
})
.catch((err) => {
    console.log(err)
})

Or using await

await base64.encode(base64String, './text.await.txt')