o
    êif                     @   s:   d Z ddlmZmZ deeee f deddfddZdS )	zAudio saving utility.    )IterableUnionaudiofilenamereturnNc                 C   sN   t | ts
d| } t|d}||  W d   dS 1 s w   Y  dS )a  
    Save audio to a file.

    Args:
        audio: Audio bytes or iterable of bytes
        filename: Path to save the audio file

    Examples:
        ```python
        from fishaudio import FishAudio, save

        client = FishAudio(api_key="...")
        audio = client.tts.convert(text="Hello world")

        # Save to file
        save(audio, "output.mp3")

        # Works with iterators too
        audio_stream = client.tts.convert(text="Another example")
        save(audio_stream, "another.mp3")
        ```
        wbN)
isinstancebytesjoinopenwrite)r   r   f r   H/home/ubuntu/.local/lib/python3.10/site-packages/fishaudio/utils/save.pysave   s
   

"r   )__doc__typingr   r   r
   strr   r   r   r   r   <module>   s    &