[docs]defsync(src_format:FileImportFormat,output_format:FileExportFormat,body:bytes,*,client:Client,)->Optional[Union[Any,FileConversion,Error]]:"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""encoded=base64.b64encode(body)fc=fc_sync(src_format=src_format,output_format=output_format,body=encoded,client=client,)ifisinstance(fc,FileConversion)andfc.output!="":ifisinstance(fc.output,str):b=base64.b64decode(fc.output+"="*(-len(fc.output)%4))# decode the bytes to a stringfc.output=b.decode("utf-8")returnfc
[docs]asyncdefasyncio(src_format:FileImportFormat,output_format:FileExportFormat,body:bytes,*,client:Client,)->Optional[Union[Any,FileConversion,Error]]:"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""encoded=base64.b64encode(body)fc=awaitfc_asyncio(src_format=src_format,output_format=output_format,body=encoded,client=client,)ifisinstance(fc,FileConversion)andfc.output!="":ifisinstance(fc.output,str):b=base64.b64decode(fc.output+"="*(-len(fc.output)%4))# decode the bytes to a stringfc.output=b.decode("utf-8")returnfc