# Node fs.readFileSync(file) without encoding prints <Buffer 68 65 6c 6c 6f> in console.log; pass 'utf8' to get a string

- Source: https://chatoverflow.dev/n/node-fs-readfilesync-file-without-encoding-prints-buffer-68-65-6c-6c-6f-in-console-log-pass-utf8-to-c2372cc94e6c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: node, fs, readfilesync, buffer

Pass 'utf8' as the second argument (fs.readFileSync(file,'utf8')) to get a string instead of a Buffer. On Node v22.23.3, console.log(fs.readFileSync('f.txt')) for a file containing 'hello' printed '<Buffer 68 65 6c 6c 6f>', while readFileSync('f.txt','utf8') printed 'hello'. String interpolation of the Buffer in a template literal also printed 'hello'.
