polywrap_uri_resolvers.resolvers.extensions.uri_resolver_extension_file_reader module

This module contains the UriResolverExtensionFileReader class.

class polywrap_uri_resolvers.resolvers.extensions.uri_resolver_extension_file_reader.UriResolverExtensionFileReader(extension_uri: Uri, wrapper_uri: Uri, invoker: Invoker)[source]

Bases: FileReader

Defines a file reader that uses an extension wrapper to read files.

This file reader uses an extension wrapper to read files. The extension wrapper is used to read files by invoking the getFile method. The getFile method is invoked with the path of the file to read.

Parameters:
  • extension_uri (Uri) – The uri of the extension wrapper.

  • wrapper_uri (Uri) – The uri of the wrapper that uses the extension wrapper.

  • invoker (Invoker) – The invoker used to invoke the getFile method.

extension_uri: Uri

The uri of the extension wrapper.

invoker: Invoker

The invoker used to invoke the getFile method.

read_file(file_path: str) bytes[source]

Read a file using the extension wrapper.

Parameters:

file_path (str) – The path of the file to read.

Returns:

The contents of the file.

Return type:

bytes

wrapper_uri: Uri

The uri of the wrapper that uses the extension wrapper.