Skip to content

Commit

Permalink
fix: resolve lint issues in messages.ts
Browse files Browse the repository at this point in the history
- Remove unused Blob import
- Replace while(true) with proper stream reading loop
  • Loading branch information
devin-ai-integration[bot] committed Dec 24, 2024
1 parent 3331d6d commit 18fd2f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/resources/messages.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit 18fd2f1

Please sign in to comment.