From 18fd2f15cf423f095173817d0cdc30466321dec7 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:28:05 +0000 Subject: [PATCH] fix: resolve lint issues in messages.ts - Remove unused Blob import - Replace while(true) with proper stream reading loop --- src/resources/messages.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/resources/messages.ts b/src/resources/messages.ts index 8cbc1e91..761ddabd 100644 --- a/src/resources/messages.ts +++ b/src/resources/messages.ts @@ -1,4 +1,4 @@ -import { FormData, File, Blob } from 'formdata-node'; +import { FormData, File } from 'formdata-node'; import APIClient, { RequestOptionsParams } from '../apiClient.js'; import { Overrides } from '../config.js'; import { @@ -332,10 +332,10 @@ export class Messages extends Resource { // For ReadableStream, we need to read it into a buffer first const chunks: Buffer[] = []; const reader = attachment.content.getReader(); - while (true) { - const { done, value } = await reader.read(); - if (done) break; - chunks.push(Buffer.from(value)); + let result = await reader.read(); + while (!result.done) { + chunks.push(Buffer.from(result.value)); + result = await reader.read(); } const buffer = Buffer.concat(chunks); file = new File([buffer], attachment.filename, { type: attachment.contentType });