Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

fix: delete videos async and logs

Christian Fei28fd354076f4
diff --git a/lib/repository.js b/lib/repository.js
index 48358d6..6d74008 100644
--- a/lib/repository.js
+++ b/lib/repository.js
@@ -137,7 +137,10 @@ export default class Repository {
const files = fs.readdirSync(`${this.basePath}/videos`)
files.forEach(file => {
if (file.startsWith(id)) {
- fs.unlinkSync(`${this.basePath}/videos/${file}`)
+ fs.unlink(`${this.basePath}/videos/${file}`, err => {
+ if (err) return console.error('failed to delete file', file)
+ console.log('deleted video file', file)
+ })
}
})
}