Easy File Share Module

Now quickly add file sharing functionality across a network with both http and ftp servers to your python project.

Experience in dark mode -

What it does ?

Quickly start a http or ftp over a directory to share data across a network.

Only works in a local area network

Installation


    pip install easyFileShare
                

Importing


    from easyFileShare import FS
                

Explore more such cool Modules

Making a object


    obj = FS.FileShareClass()
                

Visit Community Website

Built in functions :

  1. Starting a file share
  2. Stop file sharing
  3. Get ip address
  4. Get port number

Detailed Documentation :

  1. Start file share
  2. 
        obj.start_fileShare(self , folderToShare , port = 8000 , http = False , logToConsole = False , ftpDetails = ["userName" , "password_here"])
                        

    folderToShare is path to folder you want to share for example on windows you want to share a folder named hello in c drive then folderToShare = r"C:/hello"

    By default the module will start a FTP server which is important if you want to download entire folders or upload files , you can easily access it via entiring the ftp server link provided in windows file explorer top bar

    But FTP server may require specialsed software to access on mobile operation systems , so instead you can start a HTTP server their by making HTTP = True , but remember you cannot download entire folder or upload files using this

    By default module does not output anything to console , if you want to get status of whats happing in server then set logToConsole = True

    By default server will start at port 8000 but if you have some other service running at that port then you can change the port number as well , just make sure its btw 1000 and 10000

    By default , FTP server will use user as username and 225588 as password for granting write permission to client , but you can change that by passing custom username and pass in ftpDetails list format

    Module will return a list of strings containing info about how to connect to server on other device

    Server is started as sub process so can easily be terminated , see termination method below

  3. Stop file sharing
  4. 
        obj.stopFileShare()
                        

    The subprocess generated during the server start will be killed

  5. Get Ip address at which the server will be started
  6. 
        obj.get_ip_address()
                        

    Note - port number is not added into this

  7. Get port number at which the server will be started
  8. 
        obj.getPort()
                        
  9. Important
  10. 
        if __name__ == "__main__":
                        

    Main is necessary as we create a child process during server start , and if we do not do this inside main , then process will be restarted again and produce error

Sample program -


    if __name__ == "__main__":
        from easyFileShare import FS
        fil = FS.FileShareClass()
        print(fil.start_fileShare("C:/users/harsh/desktop" , http = False))

        import time
        time.sleep(60)
        fil.stopFileShare()
                

Output -


    ['Visit ftp://192.168.1.6:8000 in file explorer or FTP browse to download files', 'For Uploading as well Visit ftp://user:225588@192.168.1.6:8000 in same', 'Files only available to devices connected to the same network']
                

Explore more such cool Modules

file share example

Check out code or post issue or feature request on Github