         
         return Task(deferred)
     }
-    
+
+    // MARK: UIDocumentPickerDelegate
+    
+    public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
+        defer {
+            self.currentRequest = nil
+        }
+        guard let currentRequest = self.currentRequest, let url = urls.first else { return }
+        currentRequest.handler(url)
+    }
+
+    public func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
+        currentRequest?.handler(nil)
+        currentRequest = nil
+    }
+
     // MARK: UIImagePickerControllerDelegate
     
     public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {

    public func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
        currentRequest?.handler(nil)
        currentRequest = nil
    }
    
    private func cachePathForMedia(_ kind: Kind) -> URL {

            return nil
        }
        
        switch source {
        case .filesApp:
            guard #available(iOS 14.0, *) else { fatalError() }
            return handleRequestWithFilesApp(kind: kind, source: source, handler: handler)
        case .camera, .photoAlbum:
            return handleRequestWithImagePicker(kind: kind, source: source, handler: handler)
        }
    }

    public func createVideoThumbnail(forURL videoURL: URL) -> Task<URL> {
        let deferred = Deferred<Task<URL>.Result>()

