summaryrefslogtreecommitdiff
path: root/docs/gl_objects/projects.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/gl_objects/projects.rst')
-rw-r--r--docs/gl_objects/projects.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst
index 82a7430..5b0e208 100644
--- a/docs/gl_objects/projects.rst
+++ b/docs/gl_objects/projects.rst
@@ -380,7 +380,16 @@ Get a file::
# get the decoded content
print(f.decode())
-
+
+Get file details from headers, without fetching its entire content::
+
+ headers = project.files.head('README.rst', ref='main')
+
+ # Get the file size:
+ # For a full list of headers returned, see upstream documentation.
+ # https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository
+ print(headers["X-Gitlab-Size"])
+
Get a raw file::
raw_content = project.files.raw(file_path='README.rst', ref='main')