Is it safe to not close pyfilesystem FS objects for read-only operations on in-memory archives?

96 Views Asked by At

I see this note in the docs of TarFS of pyfilesystem

Close the filesystem and release any resources.

It is important to call this method when you have finished working with the filesystem. Some filesystems may not finalize changes until they are closed (archives for example). You may call this method explicitly (it is safe to call close multiple times), or you can use the filesystem as a context manager to automatically close.

Is that OK to not close the FS if I do read-only operations? For example:

archive = io.BytesIO(get_my_tar_as_bytes())
read_stuff_from_fs(TarFS(archive))
0

There are 0 best solutions below