File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -891,6 +891,22 @@ The following functions are available.
891891
892892 .. versionadded :: 3.9
893893
894+ .. function :: as_file(traversable)
895+
896+ Given a :class: `importlib.resources.abc.Traversable ` object representing
897+ a file, typically from :func: `importlib.resources.files `, return
898+ a context manager for use in a :keyword: `with ` statement.
899+ The context manager provides a :class: `pathlib.Path ` object.
900+
901+ Exiting the context manager cleans up any temporary file created when the
902+ resource was extracted from e.g. a zip file.
903+
904+ Use ``as_file `` when the Traversable methods
905+ (``read_text ``, etc) are insufficient and an actual file on
906+ the file system is required.
907+
908+ .. versionadded :: 3.9
909+
894910.. function :: open_binary(package, resource)
895911
896912 Open for binary reading the *resource * within *package *.
You can’t perform that action at this time.
0 commit comments