I am storing a .stl file in Postgres as a bytea.
It is retrieved as a memoryview.
I am using the memoryview to create and save a
binary file to the hard disk.
Is it possible to store the memoryview as a file in memory temporarily?
Code that works:
with open('temp.stl', 'wb') as binary_file:
binary_file.write(bytes(diagram))
self.stl_mesh = mesh.Mesh.from_file('temp.stl')
I have tried the following and have looked into using the io library, but don’t have a good enough understanding yet:
self.stl_mesh = mesh.Mesh.from_file(bytes(diagram))
error: 'utf-8' codec can't decode byte 0x80 in position 94: invalid start byte