diff --git a/package-lock.json b/package-lock.json index 664ca3d..a470207 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dat-cp", - "version": "0.7.0", + "version": "0.7.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 033b105..3d30fe0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dat-cp", - "version": "0.7.0", + "version": "0.7.1", "description": "Dat Copy - remote file copy, powered by the dat protocol", "engines": { "node": ">=6.0.0" diff --git a/src/lib/dat-cp.js b/src/lib/dat-cp.js index 6693d94..8bcb09a 100644 --- a/src/lib/dat-cp.js +++ b/src/lib/dat-cp.js @@ -192,11 +192,10 @@ export default class DatCp { process.exit(1) }, 15000) - const readRoot = setInterval(async () => { + const readRoot = async () => { const paths = await this.readdir('/') if (paths.length !== 0) { - clearInterval(readRoot) clearTimeout(abort) for (const path of paths) { @@ -211,8 +210,12 @@ export default class DatCp { this.printTotal() } resolve() + } else { + setTimeout(readRoot, 300) } - }, 300) + } + + readRoot() }) }