英文:
Programmatically trigger online-only Dropbox file download on macOS
问题
它们无法访问“仅在线” Dropbox 占位文件的零长度内容,我必须通过用户界面手动同步本地副本。
是否有一个Mac文件API,甚至是在后台运行的控制台命令,我可以以编程方式访问,以触发或强制在线仅 Dropbox 文件下载本地副本?
我尝试过像cat
这样的控制台命令,C API,如fopen()
,以及Mac/Cocoa API,如NSFileManager
,NSFileHandle
和[NSData dataWithContentsOfFile]
,但都没有成功。占位文件仍然为零字节。
英文:
I often write console-based apps and scripts, on macOS especially. They unable to access the zero-length contents of "online-only" Dropbox placeholder files and I have manually sync local copies through the UI.
Is there a Mac file API - or even a console command that runs in the background - I can programmatically access that will trigger or force an online-only Dropbox file to download a local copy?
I've tried console commands such as cat
, C API's such as fopen()
, and Mac/Cocoa API's such as NSFileManager
, NSFileHandle
, and [NSData dataWithContentsOfFile]
, without success. The placeholder files remain at zero bytes.
答案1
得分: 2
抱歉,Dropbox没有提供可用于以编程方式管理此设置的界面,例如将文件设置为“离线”。但我会将这作为功能请求传达。无法承诺是否或何时会实施这一功能。
仅在线文件应在打开时自动下载,但对于可能会影响macOS用户的某些问题除外。但这不是API本身的一部分,所以如果对您的预期效果不起作用,您可能需要联系支持。
另外,正如Mark在评论中指出的,您可以使用Dropbox API,以直接下载文件数据。例如,您可以使用 /2/files/download 终点,或者在官方Dropbox Python SDK中使用对应的files_download
方法6。
英文:
Unfortunately Dropbox doesn't offer an interface for programmatically managing this setting, such as to set a file to "offline", but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
Online-only files should be automatically downloaded when opened though, except for some issues that may affect users on macOS. That's not part of the API itself though, so if that's not working as expected for you, you may want to contact support.
Alternatively, as Mark noted in the comments, you can use the Dropbox API instead, to download file data directly. For example, you can use the /2/files/download endpoint, or the corresponding files_download
method in the official Dropbox Python SDK.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论