That’s all we can say right now.
Since its inception, NodeJS has deprecated many APIs for one of the following reasons: - Use of the API is unsafe. - An improved version of the API was introduced later. - The API may have breaking changes in a future version of Node.
This issue prevents the use of deprecated Node APIs in favor of modern ones.
const fs = require("fs");
function fetchData(fileName) {
// 'fs.exists' was deprecated since v4.
// Use 'fs.stat()' or 'fs.access()' instead.
if (fs.exists(fileName)) {
// ...
}
}
async function fetchData(fileName) {
fs.access(fileName, (error) => {
if (error) {
// Handle the error
} else {
// ...
}
})
}