Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file-handler

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-handler - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

22

index.js
var mongoose = require('mongoose');
var gm = require('gm');
var fmFilesSchema = mongoose.Schema({

@@ -17,6 +18,23 @@ });

if (err) callback(false);
else callback('/api/file/' + file._id + ".png");
else callback('/api/file/' + file._id + ".png", file._id);
});
});
};
module.exports.deleteImage = function(id, callback) {
var path = root + "/" + id + ".png";
fs.unlink(path, function(err){
if(err) throw err;
console.log("file deleted");
})
};
module.exports.createSvg = function(svg, callback) {
FmFile.create({}, function(err, file) {
var path = root + "/" + file._id + ".svg";
fs.writeFile(path, svg, function(err) {
if (err) callback(false);
else callback('/api/file/' + file._id + ".svg");
});
});
}
module.exports.config = function(config) {

@@ -27,2 +45,2 @@ root = config.root;

res.sendFile(root + '/' + req.params.fileID)
};
};

7

package.json
{
"name": "file-handler",
"version": "0.0.1",
"version": "0.0.2",
"description": "Is an project which will support saving file local on the server and multiple server, same way will support remote save with remote backup.",

@@ -10,2 +10,5 @@ "license": "MIT",

"email": "crackeraki@gmail.com"
},{
"name": "Sergey Bugai",
"email": "SergeyBugai@gmail.com"
}],

@@ -23,2 +26,2 @@ "engines": {

}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc