Skip to content

Download file content

client.Files.Content.Get(ctx, fileID, query) (*FileContentGetResponse, error)
GET/v5/files/{file_id}/content

Download the raw bytes of a file by id.

Streams the stored object’s content back directly (not a redirect or signed URL), with the response Content-Type set to the file’s stored MIME type and Content-Disposition set to attachment. Use the metadata endpoint for size, filename, and other attributes.

ParametersExpand Collapse
fileID string
query FileContentGetParams
XProjectID param.Field[string]Optional
ReturnsExpand Collapse
type FileContentGetResponse interface{…}

Download file content

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  content, err := client.Files.Content.Get(
    context.TODO(),
    "file_id",
    sgpdev.FileContentGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", content)
}
{}
Returns Examples
{}