Welcome to the Linux Foundation Forum!

Small error on 13. INTERACTING WITH THE FILE SYSTEM

at the end of Reading and Writing (2), the code:

'use strict'

const { readFile } = require('fs')

readFile(__filename, {encoding: 'utf8'},
    (err, contents)=> {
        if (err) {
            console.log(err)
            return
        }
    })

should be:

'use strict'

const { readFile } = require('fs')

readFile(__filename, {encoding: 'utf8'},
    (err, contents)=> {
        if (err) {
            console.log(err)
            return
        }
    console.log(contents)
    })

Categories

Upcoming Training