create_from_stream method
Leave feedback
On this page
Creates a document from a stream.
def create_from_stream(cls, document_key, modification_date, extension, stream):
...
| Parameter | Type | Description |
|---|---|---|
| document_key | str |
The document key. |
| modification_date | datetime |
The document modification date. |
| extension | str |
The document extension. The extension must start with the period character ‘.’. |
| stream | io.RawIOBase |
The document stream. |
Returns: Document: The created document.
import datetime
from groupdocs.search.common import Document
document_path = "path/to/file.pdf"
with open(document_path, "rb") as stream:
doc = Document.create_from_stream(
document_key=document_path,
modification_date=datetime.datetime.now(),
extension=".pdf",
stream=stream,
)
- class
Document
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.