Browse Source

Merge pull request #108 from matteo-hertel/master

Fix node js example in the readme
pull/116/head
James Cryer 7 years ago committed by GitHub
parent
commit
9273843ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      README.md

9
README.md

@ -120,8 +120,10 @@ npm install canvas
The API under Node is the same as on the browser with one addition, a promise based `compareImage` convenience function that is used as follows: The API under Node is the same as on the browser with one addition, a promise based `compareImage` convenience function that is used as follows:
``` js ``` js
const compareImage = require('resemblejs/compareImages'); const compareImages = require('resemblejs/compareImages');
const fs = require("fs");
async function getDiff(){
// The parameters can be Node Buffers // The parameters can be Node Buffers
// data is the same as usual with an additional getBuffer() function // data is the same as usual with an additional getBuffer() function
const data = await compareImages( const data = await compareImages(
@ -130,6 +132,11 @@ const data = await compareImages(
); );
fs.writeFileSync('./output.png', data.getBuffer()); fs.writeFileSync('./output.png', data.getBuffer());
}
getDiff();
``` ```
#### Tests #### Tests

Loading…
Cancel
Save