def txtToBin(filename):
    """

        Method to convert a string text in binary code.

        Parameters
        ----------
            filename : str
                The file location of the text

        Returns
        -------
            binarray : str
                The string representation of the text in binary code
    
    """

    with open(filename, 'r') as txtFile:
        text = txtFile.read()

    binarray = ''.join(format(ord(char), '08b') for char in text)

    return binarray