Skip to content

Commit

Permalink
cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowflake107 committed May 17, 2021
1 parent bd7a62e commit 7e514ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 7e514ca

Please sign in to comment.