Skip to content

Commit

Permalink
close my own stream
Browse files Browse the repository at this point in the history
  • Loading branch information
mrashed-dev committed Nov 17, 2023
1 parent 2dd8b14 commit c11f3df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/kotlin/com/nylas/resources/Attachments.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class Attachments(client: NylasClient) : Resource<Attachment>(client, Attachment
*/
@Throws(NylasOAuthError::class, NylasSdkTimeoutError::class)
fun downloadBytes(identifier: String, attachmentId: String, queryParams: FindAttachmentQueryParams): ByteArray {
return download(identifier, attachmentId, queryParams).bytes()
val download = download(identifier, attachmentId, queryParams)
val fileBytes = download.bytes()
download.close()
return fileBytes
}
}

0 comments on commit c11f3df

Please sign in to comment.