Qualify kind of stream

This commit is contained in:
Cadence Ember
2025-02-16 17:44:17 +13:00
parent 0d0ca98e13
commit a5fd30d535
11 changed files with 26 additions and 25 deletions

View File

@@ -33,7 +33,7 @@ async function convert(stickerItem) {
if (res.status !== 200) throw new Error("Sticker data file not found.")
const text = await res.text()
// Convert to PNG (readable stream)
// Convert to PNG (stream.Readable)
const readablePng = await convertLottie.convert(text)
// Upload to MXC

View File

@@ -21,7 +21,7 @@ const Rlottie = (async () => {
/**
* @param {string} text
* @returns {Promise<NodeJS.ReadableStream>}
* @returns {Promise<stream.Readable>}
*/
async function convert(text) {
const r = await Rlottie
@@ -41,6 +41,7 @@ async function convert(text) {
png.data = Buffer.from(rendered)
// png.pack() is a bad stream and will throw away any data it sends if it's not connected to a destination straight away.
// We use Duplex.from to convert it into a good stream.
// @ts-ignore
return stream.Duplex.from(png.pack())
}