Skip to content

Commit

Permalink
Cleanup du again
Browse files Browse the repository at this point in the history
  • Loading branch information
zz85 committed Oct 22, 2015
1 parent 92c855e commit da362a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 43 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ Future Enhancements
- moar!!
- let me know what you think

Whats New
==

2.0.0
- Major speed up scanning directories. About 10x from version 1, and almost as fast or faster than du.
- Runs disk scanning as a separate headless renderer process
- Json is passed back via IPC
- Remove Async npm dependency

Known Issues
==
- Electron may freeze when scanning really really large directories
- UI may freeze momentary loading large data sets

Development
==
Expand Down
42 changes: 0 additions & 42 deletions js/du.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,6 @@ const path = require('path')

let counter = 0;

/* Synchronous File System descender */
function jsonFS(parent, name, ret) {
counter++;

let dir = name ? path.join(parent, name) : parent
name = name ? name : parent;

if (counter % 100000 == 0) console.log(counter, dir);

try {
let stat = fs.lstatSync(dir)
if (stat.isSymbolicLink()) {
ret.name = name;
ret.size = 0;

} else if (stat.isFile()) {
ret.name = name;
ret.size = stat.size;
}
else if (stat.isDirectory()) {
let files = fs.readdirSync(dir)

ret.name = name;
ret.children = [];

files.forEach(file => {
let child = {}
ret.children.push(child)
jsonFS(dir, file, child)

// let child = jsonFS(dir, file, {})
// if (child) ret.children.push(child)
})
}

} catch (e) {
console.error(e.stack)
}

return ret
}

/* Asynchronous File System descender */
function descendFS(options, done) {
let dir, name, node
Expand Down

0 comments on commit da362a2

Please sign in to comment.