tcpsockets/client.py
def send_file(self, file_location: Path, chunk_size: int) -> Generator[Tuple[int, int], None, None]:
        """
        Send a file object in small chunks whose sizes are "chunk_size" each.
        Args:
            file_location(Path): Path object representing file location of the file to be sent.
            chunk_size(int): Size of 1 chunk.
        Returns:
            Generator[Tuple[int, int], None, None]: A Generator containing bytes sent and total bytes to be sent.
        """
        file_size = file_location.stat().st_size
        self.send((file_location.name, file_size))
        sent_size = 0
        with open(file_location, "rb") as file:
            file_chunk = file.read(chunk_size)
            self.socket.send(file_chunk)
            sent_size += len(file_chunk)
            yield sent_size, file_size
            while file_chunk:
                file_chunk = file.read(chunk_size)
                self.socket.send(file_chunk)
                sent_size += len(file_chunk)
                yield sent_size, file_size

        Send a file object in small chunks whose sizes are "chunk_size" each.
        Args:
            file_location(Path): Path object representing file location of the file to be sent.
            chunk_size(int): Size of 1 chunk.
        Returns:
            Generator[Tuple[int, int], None, None]: A Generator containing bytes sent and total bytes to be sent.
        
Send a file object in small chunks whose sizes are "chunk_size" each.
Send a file object in small chunks whose sizes are " chunk_size " each .
def send_file(self, file_location: Path, chunk_size: int) -> Generator[Tuple[int, int], None, None]:
        file_size = file_location.stat().st_size
        self.send((file_location.name, file_size))
        sent_size = 0
        with open(file_location, "rb") as file:
            file_chunk = file.read(chunk_size)
            self.socket.send(file_chunk)
            sent_size += len(file_chunk)
            yield sent_size, file_size
            while file_chunk:
                file_chunk = file.read(chunk_size)
                self.socket.send(file_chunk)
                sent_size += len(file_chunk)
                yield sent_size, file_size
def send_file ( self , file_location : Path , chunk_size : int ) -> Generator [ Tuple [ int , int ] , None , None ] : file_size = file_location . stat ( ) . st_size self . send ( ( file_location . name , file_size ) ) sent_size = 0 with open ( file_location , "rb" ) as file : file_chunk = file . read ( chunk_size ) self . socket . send ( file_chunk ) sent_size += len ( file_chunk ) yield sent_size , file_size while file_chunk : file_chunk = file . read ( chunk_size ) self . socket . send ( file_chunk ) sent_size += len ( file_chunk ) yield sent_size , file_size
Send a file object in small chunks whose sizes are "chunk_size" each.
Send a file object in small chunks whose sizes are " chunk_size " each .
"""
        Send a file object in small chunks whose sizes are "chunk_size" each.
        Args:
            file_location(Path): Path object representing file location of the file to be sent.
            chunk_size(int): Size of 1 chunk.
        Returns:
            Generator[Tuple[int, int], None, None]: A Generator containing bytes sent and total bytes to be sent.
        """
A Generator containing bytes sent and total bytes to be sent.
A Generator containing bytes sent and total bytes to be sent .
Generator[Tuple[int, int], None, None]
self
file_location
Path
Path object representing file location of the file to be sent.
Path object representing file location of the file to be sent .
chunk_size
int
Size of 1 chunk.
Size of 1 chunk .