dobomode / coursera-scraper

A lightweight Node.js app to fetch assets / videos for Coursera courses.
MIT License
38 stars 13 forks source link

Added functionality (skip existing files) #13

Closed lausbelphegor closed 10 months ago

dobomode commented 10 months ago

Thanks for implementing this. This feature most likely would work best as a flag set by the user. Are you happy to extend the MR to add either a runtime flag or a prompt to the user asking whether existing files should be overwritten or not?

lausbelphegor commented 10 months ago

No problem, since this was fairly simple I didn't bother checking for a bug. If it doesn't work properly let me know.

dobomode commented 10 months ago

Thanks a lot. There were a couple of issues with the MR: 1) The fileExists method was always returning false because await fs.access(filePath); expects 3 arguments and was failing. 2) I think it's better to have a global prompt rather than filewise prompt. So I've pushed your change to the top and now the app asks the user if they want to overwrite existing files at the start.