CRBT-Team / Purplet

A framework for quickly building Discord bots + more packages relating to the Discord API, with a primary goal on a rich developer experience.
https://purplet.js.org
Apache License 2.0
64 stars 1 forks source link

Rest: Support `NodeJS.ReadableStream` and `ReadableStream` in `files` array. #49

Closed paperdave closed 2 years ago

paperdave commented 2 years ago

Even if we don't have #48, it would be cool to accept these objects as a parameter file[].data.

To implement this, inspect the readablestream api for something we can detect and use, then add it to the toBlob method in packages/rest/src/utils.ts

paperdave commented 2 years ago

native readable streams (objects with a getReader() function), and the native readers (objects with read()) probably easy. idk what nodejs readable streams are exactly but I believe they're just an event emitter with a data and {end or close} events. I might pick this up soon because I've been a bit silent on my code progress and this small fix might kickstart my work back into motion.