diff --git a/README.md b/README.md index 9040669..938834e 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,14 @@ $ yarn add @canvacord/gif ## Decoding GIF ```js +// es6 import { Decoder } from '@canvacord/gif'; import { readFileSync, createWriteStream } from 'fs'; +// cjs +const { Decoder } = require('@canvacord/gif'); +const { readFileSync, createWriteStream } = require('fs'); + const source = readFileSync('./img.gif'); const decoder = new Decoder(source); const rawFrames = decoder.decode(); @@ -36,9 +41,14 @@ for (let i = 0; i < pngFrames.length; i++) { ## Encoding raw frame to GIF ```js +// es6 import { Decoder, Encoder } from '@canvacord/gif'; import { readFileSync, createWriteStream } from 'fs'; +// cjs +const { Decoder, Encoder } = require('@canvacord/gif'); +const { readFileSync, createWriteStream } = require('fs'); + const source = readFileSync('./img.gif'); const decoder = new Decoder(source); const rawFrames = decoder.decode();