Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Node JS module based on fileupload by @domharrington that takes a base64 encoded file and writes it to the filesystem, returns the same file object structure as fileupload
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
README.md
index.js
package.json

README.md

This small module is based on https://github.com/domharrington/fileupload

The main reason was not to replace fileupload but to complement it. File upload works great and is one of the easiest modules to upload files, specially when used with Express JS

This module will take a Base64 encoded image and write the image to the filesystem. It will return the same file structure as fileupload. I did this because I'm using fileupload and I needed the result object to look the same to avoid handling different result objects.

Install

npm install fileuploadbase64

Usage

var fileuploadbase64 = require("fileuploadbase64");

Params: file = the string from the encoded image directory = destination directory to save files, don't add / at the end

Example:

var directory = './public/files'; fileuploadbase64(file, directory, function(error, result) { // do something with the result file object });

File object

The file object will be something like:

{ size: 3909, type: 'image/png', path: 'b36e7d8a26e5dac9be9d9a5ad76cedb5/', basename: 'test1.png' }

Limitations

Right now it is hard-coded into the module the image extension, it will only create PNG files.

License

GNU Public License Version 3 http://www.gnu.org/copyleft/gpl.html

Something went wrong with that request. Please try again.