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

faux-knox

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faux-knox - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

42

index.js

@@ -128,31 +128,21 @@ var fs = require("fs");

var self = this;
var baseDirectory = self.config.bucket + (options.prefix || '/');
utils.checkToPath(baseDirectory, function() {
var walk = require("walk");
var walker = walk.walk(baseDirectory);
var files = [];
async.waterfall([
function (cb) {
if (!options.prefix) {
options.prefix = "/";
}
cb();
},
function (cb) {
utils.checkToPath(self.config.bucket + options.prefix, function () {
cb();
walker.on("file", function (root, stat, next) {
files.push({
Key: join(relative(self.config.bucket, root), stat.name),
Size: stat.size,
LastModified: stat.mtime
});
},
function (cb) {
var walk = require("walk");
var walker = walk.walk(self.config.bucket + options.prefix);
var files = [];
next();
});
walker.on("file", function (root, stat, next) {
var directory = relative(self.config.bucket, root);
files.push({Key: join(directory, stat.name)});
next();
});
walker.on("end", function () {
cb(null, {Contents: files});
});
}
], cb);
walker.on("end", function () {
cb(null, {Contents: files});
});
});
};

@@ -159,0 +149,0 @@

{
"name": "faux-knox",
"version": "0.1.15",
"version": "0.1.16",
"description": "Mock requests to knox module using file system",
"main": "index.js",
"registry": "https://registry.npmjs.org/",
"scripts": {

@@ -7,0 +8,0 @@ "test": "./node_modules/.bin/mocha"

@@ -147,5 +147,7 @@ var should = require("should");

if (err) return done(err);
page.Contents.should.eql([
{Key: "list/one"}, {Key: "list/two"}
]);
var files = ['list/one', 'list/two'].map(function(file){
var stats = fs.statSync('./test_files/'+file);
return {Key: file, Size: stats.size, LastModified: stats.mtime};
});
page.Contents.should.eql(files);
done();

@@ -158,5 +160,7 @@ });

if (err) return done(err);
page.Contents.should.eql([
{Key: "list/one"}, {Key: "list/two"}
]);
var files = ['list/one', 'list/two'].map(function(file){
var stats = fs.statSync('./test_files/'+file);
return {Key: file, Size: stats.size, LastModified: stats.mtime};
});
page.Contents.should.eql(files);
done();

@@ -169,5 +173,7 @@ });

if (err) return done(err);
page.Contents.should.eql([
{Key: "list_nested/level/one"}, {Key: "list_nested/level/two"}
]);
var files = ['list_nested/level/one', 'list_nested/level/two'].map(function(file){
var stats = fs.statSync('./test_files/'+file);
return {Key: file, Size: stats.size, LastModified: stats.mtime};
});
page.Contents.should.eql(files);
done();

@@ -174,0 +180,0 @@ });

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