简体   繁体   English

从 JFrog Artifactory 获取文件夹大小(归档大小)

[英]Get folder size (archive size) from JFrog Artifactory

I need to download artifact folder from JFrog.我需要从 JFrog 下载 artifact 文件夹。 Using REST API I was able to generate ZIP. However there is no header with 'Content-Length'.使用 REST API 我能够生成 ZIP。但是没有带有“Content-Length”的 header。 How can extract size of specific folder or archive?如何提取特定文件夹或存档的大小?

PS When I click download in UI I am able to see the size PS 当我在 UI 中单击下载时,我可以看到大小下载文件夹 zip 大小

You can get a file size using the File List REST API call.您可以使用文件列表REST API 调用来获取文件大小。

If you call this API on a single file, you'll get its info in a json format that also includes the size .如果您在单个文件上调用此 API,您将获得 json 格式的信息,其中还包括size Here, jq is your friend:-)在这里, jq是你的朋友:-)

curl -s -u admin:password  "https://my.jfrog.io/artifactory/api/storage/generic-local/my.zip" | jq '.size'

I just found one hidden way to do that (there must be a better way, this is just a workaround).我刚刚找到了一种隐藏的方法(必须有更好的方法,这只是一种解决方法)。 Go to artifactory web ui, open tree view, right-click on the folder and download. Go to artifactory web ui,打开树形视图,右键点击文件夹下载。 It will either tell you the folder size right away like this "Folder dir's size(19834.09077835083MB) exceeds the max allowed download size(1024MB)" or start the download, and you get the size anyway.它会立即告诉您文件夹大小,如“文件夹目录的大小(19834.09077835083MB)超过允许的最大下载大小(1024MB)”或开始下载,无论如何您都会得到大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM