Skip to content

Commit 12dee17

Browse files
author
Mark Cavage
committed
correct handling of empty directories
1 parent a34eed0 commit 12dee17

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/dirsum.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ function digest(root, method, callback) {
4949
fs.readdir(root, function(err, files) {
5050
if (err) return callback(err);
5151

52+
if (files.length === 0) {
53+
return callback(undefined, {hash: '', files: {}});
54+
}
55+
5256
var hashed = 0;
5357
files.forEach(function(f) {
5458
var path = root + '/' + f;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dirsum",
33
"description": "A small library that computes checksums of directory trees",
4-
"version": "0.1.0",
4+
"version": "0.1.1",
55
"repository": {
66
"type": "git",
77
"url": "git://github.com/mcavage/node-dirsum.git"

0 commit comments

Comments
 (0)