[GH-ISSUE #150] Write stream to a file #24

Closed
opened 2026-02-27 08:11:29 +03:00 by kerem · 1 comment
Owner

Originally created by @staniel359 on GitHub (Aug 30, 2022).
Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/150

Hello.
I need to write stream data to a file. I do

binary_data = stream.input_stream.stream().read()

with open('tempfile', 'wb') as f:
  f.write(
    binary_data
  )

But it seems like there's a memory leak of some kind.
After each time binary_data is declared, stream data is loaded into memory, but memory doesn't seem to be released.
Is there an ability to write stream data directly to a file without calling .read() on it?
(Also I'm new to Python).

Originally created by @staniel359 on GitHub (Aug 30, 2022). Original GitHub issue: https://github.com/kokarare1212/librespot-python/issues/150 Hello. I need to write stream data to a file. I do ``` binary_data = stream.input_stream.stream().read() with open('tempfile', 'wb') as f: f.write( binary_data ) ``` But it seems like there's a memory leak of some kind. After each time `binary_data` is declared, stream data is loaded into memory, but memory doesn't seem to be released. Is there an ability to write stream data directly to a file without calling `.read()` on it? (Also I'm new to Python).
kerem closed this issue 2026-02-27 08:11:29 +03:00
Author
Owner

@staniel359 commented on GitHub (Aug 30, 2022):

Sorry, missed this one.

<!-- gh-comment-id:1232038788 --> @staniel359 commented on GitHub (Aug 30, 2022): Sorry, missed [this one](https://github.com/kokarare1212/librespot-python/issues/141).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot-python-kokarare1212#24
No description provided.