From 4e8c97bfb56d5dc3154ea819d8d2454a2777af78 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Wed, 6 Dec 2017 22:16:25 -0800 Subject: [PATCH] Fix deprecation warning about no callback to fs.unlink --- src/google2vtt.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/google2vtt.js b/src/google2vtt.js index a081a086..293b64ac 100644 --- a/src/google2vtt.js +++ b/src/google2vtt.js @@ -167,7 +167,15 @@ function clearOldSubtitles() { if (stats.mtime.getTime() < Date.now() - ONE_DAY) { LOGGER.info('Deleting old subtitle file: ' + file); - fs.unlink(path.join(subtitleDir, file)); + fs.unlink(path.join(subtitleDir, file), error => { + if (error) { + LOGGER.error( + 'Failed to remove file %s: %s', + file, + error.stack + ); + } + }); } }); });