tcpsockets/client.py
def receive_file(self, file_save_location: Path, chunk_size: int) -> Generator[Tuple[int, int], None, None]:
        """
        Receive a file object in small chunks whose sizes are "chunk_size" each.
        Args:
            file_location(Path): Path object representing location of the folder where the file is to be saved.
            chunk_size(int): Size of 1 chunk.
        Returns:
            Generator[Tuple[int, int], None, None]: A Generator containing bytes received and total bytes to be received.
        """
        name, size = self.receive()
        with open(file_save_location / name, "wb") as file:
            byte_number = 0
            while byte_number < size:
                byte_chunk = self.socket.recv(chunk_size)
                byte_number += len(byte_chunk)
                file.write(byte_chunk)
                yield byte_number, size

        Receive a file object in small chunks whose sizes are "chunk_size" each.
        Args:
            file_location(Path): Path object representing location of the folder where the file is to be saved.
            chunk_size(int): Size of 1 chunk.
        Returns:
            Generator[Tuple[int, int], None, None]: A Generator containing bytes received and total bytes to be received.
        
Receive a file object in small chunks whose sizes are "chunk_size" each.
Receive a file object in small chunks whose sizes are " chunk_size " each .
def receive_file(self, file_save_location: Path, chunk_size: int) -> Generator[Tuple[int, int], None, None]:
        name, size = self.receive()
        with open(file_save_location / name, "wb") as file:
            byte_number = 0
            while byte_number < size:
                byte_chunk = self.socket.recv(chunk_size)
                byte_number += len(byte_chunk)
                file.write(byte_chunk)
                yield byte_number, size
def receive_file ( self , file_save_location : Path , chunk_size : int ) -> Generator [ Tuple [ int , int ] , None , None ] : name , size = self . receive ( ) with open ( file_save_location / name , "wb" ) as file : byte_number = 0 while byte_number < size : byte_chunk = self . socket . recv ( chunk_size ) byte_number += len ( byte_chunk ) file . write ( byte_chunk ) yield byte_number , size
Receive a file object in small chunks whose sizes are "chunk_size" each.
Receive a file object in small chunks whose sizes are " chunk_size " each .
"""
        Receive a file object in small chunks whose sizes are "chunk_size" each.
        Args:
            file_location(Path): Path object representing location of the folder where the file is to be saved.
            chunk_size(int): Size of 1 chunk.
        Returns:
            Generator[Tuple[int, int], None, None]: A Generator containing bytes received and total bytes to be received.
        """
A Generator containing bytes received and total bytes to be received.
A Generator containing bytes received and total bytes to be received .
Generator[Tuple[int, int], None, None]
self
file_save_location
Path
chunk_size
int
Size of 1 chunk.
Size of 1 chunk .
file_location
Path object representing location of the folder where the file is to be saved.
Path object representing location of the folder where the file is to be saved .