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

unifile

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unifile - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

.tmp-lexa-235

59

lib/services/ftp.js

@@ -281,6 +281,7 @@ /**

if (!err) {
var tmpFileName = '.tmp-' + request.session.ftp_user.name;
tmpFileName = pathModule.resolve(__dirname, path);
// temp file at the root of unifile
var tmpFileName = '../../.tmp-' + request.session.ftp_user.name + '-' + Math.round(Math.random()*1000);
tmpFileName = pathModule.resolve(__dirname, tmpFileName);
stream.pipe(fs.createWriteStream(tmpFileName));
ftpClient.put(dst, tmpFileName, function(err) {
ftpClient.put(tmpFileName, dst, function(err) {
fs.unlink(tmpFileName, function(){

@@ -291,3 +292,3 @@ if (!err) {

else{
cbk({success:false, message: err.code});
cbk({success:false, message: err.message, code: err.code});
}

@@ -298,3 +299,3 @@ });

else{
cbk({success:false, message: err.code});
cbk({success:false, message: err.message, code: err.code});
}

@@ -316,4 +317,12 @@ });

}
// TODO: use rename https://www.npmjs.org/package/ftp
cbk({success:false, code:501, message: 'not implemented yet'});
console.log('mv', src, dst);
exports.cp(src, dst, request, response, next, function(e){
if (e && e.success === true){
exports.rm(src, request, response, next, cbk);
}
else{
cbk(e);
}
});
}

@@ -332,11 +341,16 @@ /**

}
ftpClient.put(data, path, function(err){
if (!err){
cbk({success:true});
}
else{
cbk({success:false, message: err.code});
}
});
try{
var buffer = new Buffer(data);
ftpClient.put(buffer, path, function(err){
if (!err){
cbk({success:true});
}
else{
cbk({success:false, message: err.message, code: err.code});
}
});
}
catch(err){
cbk({success:false, message: err.message, code: err.code});
}
}

@@ -359,13 +373,14 @@ /**

if (!err) {
var tmpFileName = '.tmp-' + request.session.ftp_user.name;
tmpFileName = pathModule.resolve(__dirname, path);
stream.pipe(fs.createWriteStream(tmpFileName));
fs.unlink(tmpFileName, function(){
cbk(undefined, undefined, undefined, tmpFileName);
var data = [];
stream.on('data', function (chunk) {
data = data.concat(chunk);
});
stream.once('end', function () {
cbk({success:true}, data[0]);
});
}
else{
cbk({success:false, message: err.code});
cbk({success:false, message: err.message, code: err.code});
}
});
}
{
"name": "unifile",
"description": "Express middleware to provide a common API for cloud storage services. ",
"version": "0.0.14",
"version": "0.0.15",
"author": {

@@ -6,0 +6,0 @@ "name": "Alex Hoyau aka lexoyo"

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