detect method
Contents
[
Hide
]detect(, file_name)
Detect the file format from file name, file must be readable so Aspose.3D can detect the file format through file header.
Returns
The FileFormat
instance of the detected type or null if failed.
@staticmethod
def detect(file_name):
...
Parameter | Type | Description |
---|---|---|
file_name | str | Path to the file to detect file format. |
Exceptions
Exception | Description |
---|---|
IOException | Exception thrown when failed to read data. |
Example
from aspose.threed import FileFormat
fmt = FileFormat.detect("input.fbx")
print(f"Input file format: {fmt}")
detect(, stream, file_name)
Detect the file format from data stream, file name is optional for guessing types that has no magic header.
Returns
The FileFormat
instance of the detected type or null if failed.
@staticmethod
def detect(stream, file_name):
...
Parameter | Type | Description |
---|---|---|
stream | io.RawIOBase | Stream containing data to detect |
file_name | str | Original file name of the data, used as hint. |
Exceptions
Exception | Description |
---|---|
IOException | Exception thrown when failed to read data. |
Example
from aspose.threed import FileFormat
from io import BytesIO
import bytearray
bytes = bytearray(100)
fmt = FileFormat.detect(BytesIO(bytes), "input-file")
print(f"Input data format: {fmt}")
See Also
- module
aspose.threed.formats
- class
FileFormat
- class
PdfFormat