fent / fent/node-ytdl-core

no-overwrite option

Open
#1,151 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
JavaScript
Stars
4.7k
Forks
852
PR merge metrics
No merged PRs in 30d

Description

Is it possible that you have a "non-overwrite" option? (noclobber)...

for example, if we downloaded a video some 2 months ago and forgot and we download it again, it may download all over again.

1. If that file was perfectly ok, now we just erase it and start all over, so there is some risk if it doesn't succeed this time. Why erase a perfectly good file just to download it again?
2. If it took 45 minutes to download last time, why spend again 45 minutes to download? If we Ctrl-C after two minutes, then viola, that file was gone and now it is ruined by having a fraction of the file. We need to go through 45 minute pain to wait for the download again.

P.S. Ok, I guess we can check it ourselves... before doing the `ytdl()...` and `.pipe(fs.createWriteStream(filenameToUse));` we can use

```js
if (fs.existsSync(filenameToUse)) {
throw new Error("File already exists!!!");
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.