summaryrefslogtreecommitdiff
path: root/python/collaboration/file.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collaboration/file.py')
-rw-r--r--python/collaboration/file.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/python/collaboration/file.py b/python/collaboration/file.py
index 0cc3717d..ab566c84 100644
--- a/python/collaboration/file.py
+++ b/python/collaboration/file.py
@@ -374,7 +374,19 @@ class RemoteFile:
if not core.BNRemoteFileDeleteSnapshot(self._handle, snapshot._handle):
raise RuntimeError(util._last_error())
- def download(self, progress: 'util.ProgressFuncType' = util.nop) -> bytes:
+ def download(self, progress: 'util.ProgressFuncType' = util.nop):
+ """
+ Download a remote file and possibly dependencies to its project
+ Dependency download behavior depends on the value of the collaboration.autoDownloadFileDependencies setting
+
+ :param progress: Function to call on progress updates
+ :raises: RuntimeError if there was an error
+ """
+ value = core.BNRemoteFileDownload(self._handle, util.wrap_progress(progress), None)
+ if not value:
+ raise RuntimeError(util._last_error())
+
+ def download_contents(self, progress: 'util.ProgressFuncType' = util.nop) -> bytes:
"""
Download the contents of a remote file
@@ -384,7 +396,7 @@ class RemoteFile:
"""
data = (ctypes.POINTER(ctypes.c_ubyte))()
size = ctypes.c_size_t()
- value = core.BNRemoteFileDownload(self._handle, util.wrap_progress(progress), None, data, size)
+ value = core.BNRemoteFileDownloadContents(self._handle, util.wrap_progress(progress), None, data, size)
if not value:
raise RuntimeError(util._last_error())
return bytes(ctypes.cast(data, ctypes.POINTER(ctypes.c_uint8 * size.value)).contents)
@@ -399,6 +411,7 @@ class RemoteFile:
:return: Constructed FileMetadata object
:raises: RuntimeError if there was an error
"""
+ # TODO: deprecated, use RemoteFile.download() and ProjectFile.export()
if path is None:
path = self.default_path
file = databasesync.download_file(self, path, util.split_progress(progress, 0, [0.5, 0.5]))