Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
danielcardeenas authored Apr 6, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 9bba79c commit e97fc83
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -94,15 +94,20 @@ Puppeteer takes care of the file downloading. The decryption is being done as fa
Supports big files!

```javascript
import fs = require('fs');
import mime = require('mime-types');

client.onMessage(async (message) => {
const buffer = await client.downloadFile(message);
// At this point you can do whatever you want with the buffer
// Like writing it intto a file
const fileName = `some-file-name.${mime.extension(message.mimetype)}`;
fs.writeFile(fileName, buffer, function (err) {
...
if (message.isMedia) {
const buffer = await client.downloadFile(message);
// At this point you can do whatever you want with the buffer
// Like writing it intto a file
const fileName = `some-file-name.${mime.extension(message.mimetype)}`;
fs.writeFile(fileName, buffer, function (err) {
...
});
});
});
}
```
## Basic functions (usage)

0 comments on commit e97fc83

Please sign in to comment.