You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node will assume you are interested in the binary data and will give you a Buffer object instead of a string. This is
an array-like object that contains numbers representing the bytes (8-bit chunks of data) in the files.
const {readFile} = require("fs");readFile("file.txt", (error, buffer) => {if (error) throw error;console.log("The file contained", buffer.length, "bytes.","The first byte is:", buffer[0]);});