From 3e45cbbcabd5be0849aed2eeafc87f17d77d6267 Mon Sep 17 00:00:00 2001 From: Lankesh Zade Date: Wed, 24 Mar 2021 17:20:17 +0530 Subject: [PATCH] Fix for TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined, when unwatch() is called on tail object --- index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6b754fd..b687c02 100644 --- a/index.js +++ b/index.js @@ -161,7 +161,11 @@ Tail = (function(_super) { }; if (self.fd) { - fs.close(self.fd); + /** + * Fix for TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined, + * when unwatch() is called on tail object + */ + fs.close(self.fd, function() {}); self.fd = null; }; @@ -169,7 +173,11 @@ Tail = (function(_super) { for (var i in self.queue) { var item = self.queue[i]; if (item.type == 'close') { - fs.close(item.fd); + /** + * Fix for TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined, + * when unwatch() is called on tail object + */ + fs.close(item.fd, function() {}); }; };