def _load_documents_with_metadata(
        self, files_metadata: Dict[str, Any], temp_dir: str
    ) -> List[Document]:
        """Load documents from a directory and extract metadata."""

        def get_metadata(file_name: str) -> Dict[str, Any]:
            sanitized_file_name = os.path.basename(file_name)
            metadata = files_metadata.get(sanitized_file_name, {})
            return dict(**metadata)

        loader = SimpleDirectoryReader(
            input_dir=temp_dir,
            file_extractor=self.file_extractor,
            file_metadata=self.file_metadata_fn or get_metadata,
            filename_as_id=self.filename_as_id,
        )

        return loader.load_data()
Load documents from a directory and extract metadata.
llama-index-integrations/readers/llama-index-readers-azstorage-blob/llama_index/readers/azstorage_blob/base.py