The error seems to mean that you have too many file descriptions open.
You have to make sure at some point that you close()
them.
var fd = fs.openSync(filePath,"r");
var fr = fs.readSync(fd, buffer, 0, size, 0);
fs.closeSync(fd);
As for how to handle the error, you can use try...catch
with throw
n errors:
try {
var fd = fs.openSync(filePath,"r");
var fr = fs.readSync(fd, buffer, 0, size, 0);
fs.closeSync(fd);
} catch (e) {
console.log('Error:', e);
}