Fix fetch buffer deprecation warnings

5db7a9cf1e72ee35ecc331454dc06937a9762075

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +8 -8Ignore whitespace
src/endpoints/azure.js+1 -1
@@ -79,7 +79,7 @@ router.post('/generate', jsonParser, async (req, res) => {
7979 return res.sendStatus(500);
8080 }
8181
8282 const audio = Buffer.from(await response.bufferarrayBuffer());
8383 res.set('Content-Type', 'audio/ogg');
8484 return res.send(audio);
8585 } catch (error) {
src/endpoints/content-manager.js+7 -7
@@ -336,7 +336,7 @@ async function downloadChubLorebook(id) {
336336 }
337337
338338 const name = id.split('/').pop();
339339 const buffer = Buffer.from(await result.bufferarrayBuffer());
340340 const fileName = `${sanitize(name)}.json`;
341341 const fileType = result.headers.get('content-type');
342342
@@ -359,7 +359,7 @@ async function downloadChubCharacter(id) {
359359 throw new Error('Failed to download character');
360360 }
361361
362362 const buffer = Buffer.from(await result.bufferarrayBuffer());
363363 const fileName = result.headers.get('content-disposition')?.split('filename=')[1] || `${sanitize(id)}.png`;
364364 const fileType = result.headers.get('content-type');
365365
@@ -398,7 +398,7 @@ async function downloadPygmalionCharacter(id) {
398398 }
399399
400400 const avatarResult = await fetch(avatarUrl);
401401 const avatarBuffer = Buffer.from(await avatarResult.bufferarrayBuffer());
402402
403403 const cardBuffer = write(avatarBuffer, JSON.stringify(characterData));
404404
@@ -477,7 +477,7 @@ async function downloadJannyCharacter(uuid) {
477477 const downloadResult = await result.json();
478478 if (downloadResult.status === 'ok') {
479479 const imageResult = await fetch(downloadResult.downloadUrl);
480480 const buffer = Buffer.from(await imageResult.bufferarrayBuffer());
481481 const fileName = `${sanitize(uuid)}.png`;
482482 const fileType = imageResult.headers.get('content-type');
483483
@@ -499,7 +499,7 @@ async function downloadAICCCharacter(id) {
499499 }
500500
501501 const contentType = response.headers.get('content-type') || 'image/png'; // Default to 'image/png' if header is missing
502502 const buffer = Buffer.from(await response.bufferarrayBuffer());
503503 const fileName = `${sanitize(id)}.png`; // Assuming PNG, but adjust based on actual content or headers
504504
505505 return {
@@ -537,7 +537,7 @@ async function downloadGenericPng(url) {
537537 const result = await fetch(url);
538538
539539 if (result.ok) {
540540 const buffer = Buffer.from(await result.bufferarrayBuffer());
541541 const fileName = sanitize(result.url.split('?')[0].split('/').reverse()[0]);
542542 const contentType = result.headers.get('content-type') || 'image/png'; //yoink it from AICC function lol
543543
@@ -581,7 +581,7 @@ async function downloadRisuCharacter(uuid) {
581581 throw new Error('Failed to download character');
582582 }
583583
584584 const buffer = Buffer.from(await result.bufferarrayBuffer());
585585 const fileName = `${sanitize(uuid)}.png`;
586586 const fileType = 'image/png';
587587