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

faux-knox-2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faux-knox-2 - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

newLog.log

26

index.js

@@ -89,3 +89,29 @@ var fs = require("fs");

};
Client.prototype.copyFile = function(from, to, callback) {
var self = this;
utils.checkToPath(self.config.bucket + to, function() {
var readStream = fs.createReadStream(self.config.bucket + from);
var writeStream = fs.createWriteStream(self.config.bucket + to);
var isDone = false;
var done = function (err) {
if (isDone) return;
isDone = true;
if (err) {
return callback(err);
}
return callback(null, {headers:{}, statusCode:201});
};
readStream.on("error", done);
writeStream.on("error", done);
writeStream.on("close", function () {
done();
});
readStream.pipe(writeStream);
});
};
module.exports.createClient = function(config) {

@@ -92,0 +118,0 @@ return new Client(config);

2

package.json
{
"name": "faux-knox-2",
"version": "0.1.6",
"version": "0.1.7",
"description": "Mock requests to knox module using file system",

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

@@ -109,2 +109,22 @@ var should = require("should");

});
describe("copyFile", function () {
before(function(done) {
client.putFile("./test_files/put/fort_knox_tank.jpg", "to/a/new/path/here/tank.jpg", done);
});
it("should copy a file", function (done) {
function fileExists(value, callback) {
fs.exists("./test_files/to/a/new/path/here/tankCopy.jpg", function(exists) {
should.strictEqual(exists, value);
callback();
});
}
fileExists(false, function() {
client.copyFile("to/a/new/path/here/tank.jpg", "to/a/new/path/here/tankCopy.jpg", function(err, res) {
res.should.have.property("headers").be.a("object");
res.should.have.property("statusCode", 201);
fileExists(true, done);
});
});
});
});
after(function(done) {

@@ -111,0 +131,0 @@ async.each(["./test_files/from", "./test_files/to"], rimraf, done);

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