pythonpyfilesystem

Can pyfilesystem combine schemas?


I would like to use pyfilesystem with a combination of schemas. For example, I want to open a tar file on an FTP server and I would do ftp+tar://user:password@host:port/path/file.tar.gz.


Solution

  • Not as such, however the TarFS constructor accepts an open file. So something along these lines should work:

    with open_fs("ftp://user:password@host:port/") as ftp_fs:
        with ftp_fs.open("path/file.tar.gz") as tar_file:
            my_tar = TarFS(tar_file)
            my_tar.tree()