Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d384790

Browse files
committedMay 16, 2016
Skip already processed files
1 parent d8e1e8f commit d384790

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const copyToDestination = torrents => Promise.resolve(torrents)
5959
.then(runAll)
6060
;
6161

62-
const report = files => files.forEach(file => console.log(`Successfully extracted ${path.basename(file.destination)}`));
62+
const report = files => files.forEach(file => console.log(`${file.skipped ? 'Skipped' : 'Successfully extracted'} => ${path.basename(file.destination)}`));
6363

6464
const getSourceAndDestination = torrent => ({
6565
source: path.join(torrent.folder, torrent.fileStats[0].name),
@@ -72,6 +72,9 @@ const notNull = value => !!value;
7272

7373
const fullyDownloaded = torrent => torrent.fileStats[0].size === torrent.files[0].length;
7474

75-
const copyFile = file => copy(file.source, file.destination, { replace: true }).thenReturn(file);
75+
const copyFile = file => copy(file.source, file.destination, { replace: false })
76+
.thenReturn(file)
77+
.catch(() => _.assign({ skipped: true }, file))
78+
;
7679

7780
extractFilesFromCache();

0 commit comments

Comments
 (0)
Please sign in to comment.