f2b64

1.0.1 • Public • Published

logo-f2b64

NPM Version Node.js Version

Javascript utility for converting files to base64 to save to database and convert back to save or download file.

Install

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm i f2b64

API

const f2b64 = require("f2b64");

f2b64.convertFile2B64(path)

It can convert any file to base64 to save to database. Keeping these fields in the collection or column.

let result = f2b64.convertFile2B64(path);

let namefile = result.name;
let extension = result.ext;
let mimetype = result.mtype;
let array = result.array;

f2b64.convertB642File(namefile, extension, mimetype, array);

Retrieve the file to burn to disk or send as a client download. Passing the parameters retrieved from the database.

let b642file = f2b64.convertB642File(namefile, extension, mimetype, array);

res.setHeader(b642file.contentDisposition, b642file.attachment);
res.type(b642file.type);
res.send(b642file.body); // send download client

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i f2b64

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

18.2 kB

Total Files

4

Last publish

Collaborators

  • pedrodavi