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

rest-fs

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-fs - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

46

fileserver.js

@@ -148,3 +148,3 @@ // fileserver

fileDriver.move(dirPath, req.body.newPath, options,
sendCode(200, req, res, next, formatOutData(req, dirPath)));
sendCode(200, req, res, next, formatOutData(req, req.body.newPath)));
return;

@@ -211,13 +211,5 @@ }

var clobber = req.body.clobber || false;
fileDriver.rmdir(dirPath, clobber, function (err) {
if (err && err.code === 'ENOENT') {
sendCode(404, req, res, next, formatOutData(req, dirPath))(null);
} else if (err && err.code === 'EPERM') {
sendCode(403, req, res, next, formatOutData(req, dirPath))(null);
} else if (err && err.code === 'ENOTDIR') {
sendCode(400, req, res, next, formatOutData(req, dirPath))(null);
} else {
sendCode(200, req, res, next, formatOutData(req, dirPath))(err);
}
});
fileDriver.rmdir(dirPath, clobber,
sendCode(200, req, res, next, formatOutData(req, dirPath))
);
};

@@ -234,13 +226,5 @@

var dirPath = decodeURI(url.parse(req.url).pathname);
fileDriver.unlink(dirPath, function (err) {
if (err && err.code === 'ENOENT') {
sendCode(404, req, res, next, formatOutData(req, dirPath))(null);
} else if (err && err.code === 'EPERM') {
sendCode(403, req, res, next, formatOutData(req, dirPath))(null);
} else if (err && err.code === 'EISDIR') {
sendCode(400, req, res, next, formatOutData(req, dirPath))(null);
} else {
sendCode(200, req, res, next, formatOutData(req, dirPath))(err);
}
});
fileDriver.unlink(dirPath,
sendCode(200, req, res, next, formatOutData(req, dirPath))
);
};

@@ -262,4 +246,18 @@

if (err) {
return next(err);
code = 500;
out = err;
if (err.code === 'ENOENT') {
code = 404;
} if (err.code === 'EPERM') {
code = 403;
} if (err.code === 'ENOTDIR' || err.code === 'EISDIR') {
code = 400;
} if (err.code === 'ENOTEMPTY' ||
err.code === 'EEXIST' ||
err.code === 'EINVAL') {
code = 409;
}
}
res.status(code).send(out);

@@ -266,0 +264,0 @@ };

{
"name": "rest-fs",
"version": "0.1.4",
"version": "0.1.5",
"description": "restful fileserver",

@@ -5,0 +5,0 @@ "main": "fileserver.js",

@@ -308,3 +308,3 @@ var Lab = require('lab');

.del(dir1)
.expect(500)
.expect(409)
.end(function(err, res){

@@ -311,0 +311,0 @@ if (err) {

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