'Using Buffer.from() with the contents of fs.readFileSync() makes a buffer with different data
let fb = fs.readFileSync(filePath);
let fileData = fb.toString("utf8");
b = Buffer.from(fileData, "utf8");
console.log(fb);
console.log(b);
console.log(b == fb);
console.log(b.toString("utf8") === fb.toString("utf8"));
I converted buffer to UTF8 string and again tried to get the buffer back using Buffer.from() but I can see that two buffer are different. However, if I again compare toString() result of these two buffers they are same.
Output of the above program
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

