Skip to main content

Documentation Index

Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt

Use this file to discover all available pages before exploring further.

base64encode(str) encodes str as standard base64 and returns the encoded string.

Signature

base64encode(str string) string

Example

Encode credentials for an HTTP Basic Auth header before passing them to a command:
variable "username" {
  description = "API username"
  type        = string
}

variable "password" {
  description = "API password"
  type        = string
}

computed "basic_auth" {
  description = "Base64-encoded Basic Auth credentials"
  expression  = base64encode("${var.username}:${var.password}")
}

task "publish-artifact" {
  description = "Upload a build artifact to the package registry"
  commands = [
    "curl -X PUT https://registry.example.com/api/artifact -H 'Authorization: Basic ${computed.basic_auth}' --data-binary @dist/app.tar.gz",
  ]
}

Notes

  • The output uses standard base64 (with + and /). Some systems expect URL-safe base64 (with - and _). Use replace to convert the + and / characters if needed.
  • For the reverse operation, use base64decode.