Skip to main content
Access and read the actual content of your stored files for processing, analysis, or integration with your applications.
Two Methods Available:
  • content(): Retrieve file content for reading/processing in memory
  • download(): Download files directly to disk with enhanced metadata

Get File Content

Retrieve file content for reading or processing:
gravixlayer files content file-abc123def456
Get content by filename:
gravixlayer files content README.md
Example Output:
📄 Retrieving file content: README.md
   Looking up file by name...
   Found file ID: a804e4a3-ea8b-4ac7-855b-c7977f9d0ed4
   
# GravixLayer SDK
This is the content of your file...

Download File to Disk

Use the download() method to save files directly to disk:
gravixlayer files download file-abc123def456 --output downloaded.pdf
Download by filename:
gravixlayer files download README.md --output test_readme.md
Download without specifying output (uses original filename):
gravixlayer files download file-abc123def456
Example Output:
📥 Downloading file: README.md
   Looking up file by name...
   Found file ID: a804e4a3-ea8b-4ac7-855b-c7977f9d0ed4
✅ File downloaded to: test_readme.md

Download Multiple Files to Disk

import os
from gravixlayer import GravixLayer

client = GravixLayer()

file_ids = ["file-abc123", "file-def456", "file-ghi789"]

# Download multiple files to disk
for file_id in file_ids:
    try:
        file_info = client.files.retrieve(file_id)
        file_data = client.files.download(file_id)
        
        with open(f"downloaded_{file_info.filename}", "wb") as f:
            f.write(file_data)
        
        print(f"✅ Downloaded: {file_info.filename}")
    except Exception as e:
        print(f"❌ Error downloading {file_id}: {e}")