> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud Storage

## &#x20;Google Cloud Storage: List Directory of

```javascript theme={null}
cloud.google.storage.list_directory {
  service_account = ""
  bucket = ""
  path = ""
} as x1
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| path | Directory path to list | `"folder/"`, `"uploads/"` |
| as | Alias for directory listing | `x1`, `directory_contents` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.list_directory {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "app-assets"
>   path = "images/2024/"
> } as folder_listing
> ```
>
> * Lists contents of a GCS directory
> * Returns object names and metadata
> * Supports nested directories
> * Lists all objects in specified path

## &#x20;Google Cloud Storage: Get Signed URL of

```javascript theme={null}
cloud.google.storage.sign_url {
  service_account = ""
  bucket = ""
  filePath = ""
  method = "GET"
  ttl = 300
} as x2
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| filePath | Path to file | `"documents/file.pdf"` |
| method | HTTP method to allow | `"GET"`, `"PUT"` |
| ttl | Time-to-live in seconds | `300`, `3600` |
| as | Alias for signed URL | `x2`, `signed_url` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.sign_url {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "private-files"
>   filePath = "secure/"|add:$file.path
>   method = "GET"
>   ttl = 1800
> } as download_url
> ```
>
> * Generates signed URL for temporary access

## &#x20;Google Cloud Storage: Get Signed URL of

```javascript theme={null}
cloud.google.storage.sign_url {
  service_account = ""
  bucket = ""
  filePath = ""
  method = "GET"
  ttl = 300
} as x2
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| filePath | Path to file | `"documents/file.pdf"` |
| method | HTTP method to allow | `"GET"`, `"PUT"` |
| ttl | Time-to-live in seconds | `300`, `3600` |
| as | Alias for signed URL | `x2`, `signed_url` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.sign_url {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "private-files"
>   filePath = "secure/"|add:$file.path
>   method = "GET"
>   ttl = 1800
> } as download_url
> ```
>
> * Generates signed URL for temporary access

## &#x20;Google Cloud Storage: Upload file to

```javascript theme={null}
cloud.google.storage.upload_file {
  service_account = ""
  bucket = ""
  filePath = ""
  file = ""
  metadata =
}
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| filePath | Destination path in bucket | `"uploads/file.jpg"` |
| file | File to upload | `$input.file` |
| metadata | Custom metadata for object | `{contentType: "image/jpeg"}` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.upload_file {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "user-content"
>   filePath = $user.id|add:"/profile.jpg"
>   file = $input.profile_photo
>   metadata = {
>     userId: $user.id,
>     uploadTime: $now
>   }
> }
> ```
>
> * Uploads file to Google Cloud Storage
> * Supports custom metadata

## &#x20;Google Cloud Storage: Delete file

```javascript theme={null}
cloud.google.storage.delete_file {
  service_account = ""
  bucket = ""
  filePath = ""
}
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| filePath | Path to file to delete | `"folder/file.txt"` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.delete_file {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "temp-storage"
>   filePath = "temp/"|add:$file.name
> }
> ```
>
> * Deletes an object from storage

## &#x20;Google Cloud Storage: Create Var From File Resource

```javascript theme={null}
cloud.google.storage.read_file {
  service_account = ""
  bucket = ""
  filePath = ""
} as x3
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| filePath | Path to file to read | `"documents/file.txt"` |
| as | Alias for file contents | `x3`, `file_data` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.read_file {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "app-data"
>   filePath = "documents/"|add:$doc.id
> } as document_contents
> ```
>
> * Reads object contents
> * Returns file data

## &#x20;Google Cloud Storage: Get File Metadata

```javascript theme={null}
cloud.google.storage.get_file_info {
  service_account = ""
  bucket = ""
  filePath = ""
} as x4
```

| Parameter | Purpose | Example |
| - | - | - |
| service\_account | GCP service account JSON | `{"type": "service_account", ...}` |
| bucket | GCS bucket name | `"my-app-bucket"` |
| filePath | Path to file | `"folder/file.txt"` |
| as | Alias for file metadata | `x4`, `object_info` |

> [accordion] Example
>
> ```javascript theme={null}
> cloud.google.storage.get_file_info {
>   service_account = $env.GCP_SERVICE_ACCOUNT
>   bucket = "media-files"
>   filePath = "videos/"|add:$video.id
> } as file_metadata
> ```
>
> * Retrieves object metadata


## Related topics

- [Cloud Services](https://docs.xano.com/the-function-stack/functions/cloud-services.md)
- [2022 Release Notes](https://docs.xano.com/updates/2022.md)
- [2023 Release Notes](https://docs.xano.com/updates/2023.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.