file-to-datauri
Convert local files into data uris with ease.
Installation
npm install --save file-to-datauri
How it works
Read the file, either sync or async, find mime using file extension, and return file content encoded as data-uri.
Only support utf8 encoded files.
Usage
// use with a callback ; // use with promise (if no callback given) async { const uri = ; console; }; // use sync const uri = datauri; console;
Credits
Inspired by data-uri
License
The MIT License (MIT)
Copyright (c) 2015 Andrea Parodi