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: no unlinkSync

Christian Fei43c9f8767769
diff --git a/lib/router/api.js b/lib/router/api.js
index 5f15b72..a04a4d2 100644
--- a/lib/router/api.js
+++ b/lib/router/api.js
@@ -229,9 +229,9 @@ async function reclaimDiskSpaceHandler (req, res, repo) {
.forEach((video) => {
try {
const filenames = fs.readdirSync('./data/videos').filter(f => f.startsWith(video.id))
- filenames.forEach(filename => {
- fs.unlinkSync(`./data/videos/${filename}`)
- })
+ filenames.forEach(filename => fs.unlink(`./data/videos/${filename}`, err => {
+ if (err) console.error(err)
+ }))
repo.updateVideo(video.id, { downloaded: false })
} catch (err) {
console.error(err.message)