mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +01:00
re-added missing base64ToLocal method in file lib
This commit is contained in:
11
src/file.js
11
src/file.js
@@ -38,6 +38,17 @@ file.saveFileToLocal = function(filename, folder, tempPath, callback) {
|
||||
is.pipe(os);
|
||||
};
|
||||
|
||||
file.base64ToLocal = function(imageData, uploadPath, callback) {
|
||||
var buffer = new Buffer(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
|
||||
uploadPath = path.join(nconf.get('base_dir'), nconf.get('upload_path'), uploadPath);
|
||||
|
||||
fs.writeFile(uploadPath, buffer, {
|
||||
encoding: 'base64'
|
||||
}, function(err) {
|
||||
callback(err, uploadPath);
|
||||
});
|
||||
};
|
||||
|
||||
file.isFileTypeAllowed = function(path, callback) {
|
||||
// Attempt to read the file, if it passes, file type is allowed
|
||||
jimp.read(path, function(err) {
|
||||
|
||||
Reference in New Issue
Block a user