How to check if two files have the same content?

前端 未结 6 637
说谎
说谎 2021-02-05 10:35

I am using mocha/supertest/should.js to test my Rest Service

GET /files/ returns file as stream.

How can I assert in should.js

6条回答
  •  春和景丽
    2021-02-05 10:49

    Surprisingly, no one has suggested Buffer.equals. That seems to be the fastest and simplest approach and has been around since v0.11.

    So your code would become tmpBuf.equals(testBuf)

提交回复
热议问题