tslint Error - Shadowed name: 'err'

Add this comment just above the error line--

// tslint:disable-next-line:no-shadowed-variable


This shadowed name tslint error is due to repetition of the name 'err' twice in your callback functions. You can change either anyone 'err' to other name so this should work.

Example: This should work

fs.readdir(fileUrl, (error, files) => {
        fs.readFile(path.join(fileUrl, files[0]), function (err, data) {
            if (!err) {
                res.send(data);
            }
        });
    });

You are using the same variable "err" in both outer and inner callbacks, which is prevented by tslint.

If you want to use the same variable then "no-shadowed-variable": false, otherwise do as below.

fs.readdir(fileUrl, (readDirError, files) => {
    fs.readFile(path.join(fileUrl, files[0]), function (err, data) {
            if (!err) {
                res.send(data);
            }
        });
    });