file-base64
Version:
encode a file to base64 string or decode a base64 string to file.
26 lines (18 loc) • 430 B
Markdown
- Encode a file to a base64 string
- Dncode a base64 string to a file
``` bash
$ npm install file-base64 --save
```
``` js
var base64 = require('file-base64');
base64.encode('text.txt', function(err, base64String) {
console.log(base64String);
});
var base64String = 'swesh523sfsfgwg';
base64.decode(base64String, 'text.new.txt' function(err, output) {
console.log('success');
});
```