A
A
alaskafx2021-10-06 19:34:56
Node.js
alaskafx, 2021-10-06 19:34:56

Error while trying to read nodejs fs file?

I'm trying to read a file using fs:

fs.readFile('./cases.json', 'utf8', (err, data) => {
    if (err) {
        console.log(`Error reading file from disk: ${err}`);
    } else {
        console.log('НАКОНЕЦ')
    }
});


but it gives me this error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type 
string or an instance of Buffer or URL. Received an instance of Array

how to solve?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question