Skip to content

Commit

Permalink
Update Attachment.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Starman3787 committed Nov 26, 2024
1 parent 850b58c commit a3efb13
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/structures/Attachment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fetch from "node-fetch";
import Client from "../Client.js";
import { CDN_BASE_URL, TO_JSON_TYPES_ENUM } from "../constants.js";
import util from "util";
Expand Down Expand Up @@ -138,6 +139,16 @@ class Attachment {
return this.#_channel_id ? String(this.#_channel_id) : undefined;
}

/**
* Fetches the data of the attachment.
* @returns {Promise<ArrayBuffer>}
* @public
*/
async fetchData() {
const res = await fetch(this.url);
return res.arrayBuffer();
}

/**
* @method
* @public
Expand Down

0 comments on commit a3efb13

Please sign in to comment.