2

I'm writing a spec using Jasmine Node and I'd like to compare the content of files on disk with the content of files in memory to check that they are equal.

Most of the files are text, but one is an image file (PNG).

How can this can be done?

Eliot Sykes
  • 9,616
  • 6
  • 50
  • 64

1 Answers1

3

In node.js you can read data like Buffer, so you can compare data in binary format

b1.toString("binary") == b2.toString("binary");
// were b1 and b2 is Buffer

For node.js buffer comparison you can see this post

Community
  • 1
  • 1
Microshine
  • 731
  • 5
  • 19