From da362a221b9c7f75edf02caa6ba71812d1493c33 Mon Sep 17 00:00:00 2001 From: Joshua Koo Date: Fri, 23 Oct 2015 06:13:33 +0800 Subject: [PATCH] Cleanup du again --- README.md | 11 ++++++++++- js/du.js | 42 ------------------------------------------ 2 files changed, 10 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index ed606ba..361ed4c 100644 --- a/README.md +++ b/README.md @@ -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 == diff --git a/js/du.js b/js/du.js index 0da9ffa..687f318 100644 --- a/js/du.js +++ b/js/du.js @@ -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