43081j / id3

A JavaScript ID3 tags parser for Node & browsers.
MIT License
335 stars 63 forks source link

Error with Node 11.5 [10.0.0+]"Callback must be a function" #41

Closed scarabdesign closed 5 years ago

scarabdesign commented 5 years ago

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at makeCallback (fs.js:143:11) at Object.close (fs.js:401:20) at Reader.close (/server/node_modules/id3js/dist/id3.js:69:7) at /server/node_modules/id3js/dist/id3.js:967:12 at process (/server/node_modules/id3js/dist/id3.js:837:7) at /server/node_modules/id3js/dist/id3.js:950:6 at /server/node_modules/id3js/dist/id3.js:118:4 at FSReqCallback.wrapper [as oncomplete] (fs.js:480:5)

Running against Node 11.5, but according to fs docs, a callback was required since 10. To test, I inserted a noop function and it worked fine.

smikula commented 5 years ago

I'm hitting this too (on Node 11.1.0).

@43081j: are you still maintaining this? Would you accept a PR to fix it?

smikula commented 5 years ago

In case it helps anyone else hitting this issue, I've worked around it by shimming fs.close like this:

function shimFs() {
    var fsClose = fs.close;
    fs.close = function(fd, callback) {
        fsClose(fd, callback || function() {});
    };
}
43081j commented 5 years ago

I haven't had much time lately to maintain this, sorry about that.

There are a few stale PRs that refactor/cleanup but im tempted to just get on with my typescript rewrite and ship that this weekend. We will see how it goes, ill try sort the bugs out either way