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

dirkeeper

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

dirkeeper - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

2

index.js

@@ -73,3 +73,3 @@ var async = require('async')

if (err) return cb(err)
pruneToCount(opts.count, dirs, cb)
pruneToCount(opts.count, dirs.filter(function(d) { if (!d) return; return d }), cb)
})

@@ -76,0 +76,0 @@ }

{
"name": "dirkeeper",
"version": "0.1.2",
"version": "0.2.0",
"description": "Prune a directory to contain a set number of sub-directories, retention policy is recency",

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

@@ -14,2 +14,11 @@ var async = require('async')

// Return only directories from the list of file names
function filterDirs(base, files) {
return files.filter(function(f) {
var stat = fs.statSync(path.join(base, f))
if (!stat.isDirectory()) return
return f
})
}
function makeDirs(baseDir, numDirs, cb) {

@@ -53,3 +62,6 @@ var count = 0

}
], done)
], function(err) {
fs.writeFileSync(path.join(TEN_SUBDIRS, "a_test_file"), "foobar")
done()
})
})

@@ -94,3 +106,4 @@

fs.readdir(FOUR_SUBDIRS, function(err, files) {
expect(files).to.have.length(0)
var dirs = filterDirs(TEN_SUBDIRS, files)
expect(dirs).to.have.length(0)
done()

@@ -107,3 +120,4 @@ })

fs.readdir(TEN_SUBDIRS, function(err, files) {
expect(files).to.have.length(10)
var dirs = filterDirs(TEN_SUBDIRS, files)
expect(dirs).to.have.length(10)
done()

@@ -119,5 +133,6 @@ })

fs.readdir(TEN_SUBDIRS, function(err, files) {
expect(files).to.have.length(5)
var dirs = filterDirs(TEN_SUBDIRS, files)
expect(dirs).to.have.length(5)
// the earliest dir names are the oldest. see makeDirs().
expect(files).to.not.contain(['tmpfile.0', 'tmpfile.1', 'tmpfile.2', 'tmpfile.3', 'tmpfile.4'])
expect(dirs).to.not.contain(['tmpfile.0', 'tmpfile.1', 'tmpfile.2', 'tmpfile.3', 'tmpfile.4'])
done()

@@ -124,0 +139,0 @@ })

Sorry, the diff of this file is not supported yet

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