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:

  1. 'use strict'
  2.  
  3. const { readFile } = require('fs')
  4.  
  5. readFile(__filename, {encoding: 'utf8'},
  6. (err, contents)=> {
  7. if (err) {
  8. console.log(err)
  9. return
  10. }
  11. })

should be:

  1. 'use strict'
  2.  
  3. const { readFile } = require('fs')
  4.  
  5. readFile(__filename, {encoding: 'utf8'},
  6. (err, contents)=> {
  7. if (err) {
  8. console.log(err)
  9. return
  10. }
  11. console.log(contents)
  12. })
  13.  

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training