- file_stream = open(file_path, 'wb+')
- self.fs.download_to_stream(writing_file._id, file_stream)
- file_stream.close()
- if "permissions" in writing_file.metadata:
- if writing_file.metadata["type"] == "sym":
- os.chmod(
- file_path,
- writing_file.metadata["permissions"] | stat.S_IFLNK
- )
- else:
+
+ if writing_file.metadata["type"] == "sym":
+ with BytesIO() as b:
+ self.fs.download_to_stream(writing_file._id, b)
+ b.seek(0)
+ link = b.read().decode("utf-8")
+ os.symlink(link, file_path)
+ else:
+ with open(file_path, 'wb+') as file_stream:
+ self.fs.download_to_stream(writing_file._id, file_stream)
+ if "permissions" in writing_file.metadata: