← All procedures

s3.head

The metadata of an object, without its content (exists: false for a 404)

CLI
Package
@procedures/s3 · README
Path
["s3","head"]
CLI
mark s3 head --bucket <string> --key <string>
As data
{"$proc":["s3","head"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/s3/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["s3","head"], { bucket: "<bucket>", key: "<key>" });
console.log(JSON.stringify(result));

From the command line

$ mark s3 head --bucket <string> --key <string>

As data, in a program

{
  "$proc": ["s3", "head"],
  "input": { "bucket": "<bucket>", "key": "<key>" }
}

Input

FieldTypeRequiredDefaultDescription
bucketstringyesThe bucket
keystringyesThe object key
versionIdstringnoA version of the object (default: the current version)

Output

FieldTypeRequiredDefaultDescription
existsbooleanyesFalse when S3 answers 404: the key or the bucket does not exist
contentLengthnumbernoThe size of the object, in bytes
contentTypestringnoThe content type
etagstringnoThe ETag of the object, without quotes
lastModifiedstringnoThe time of the last change (ISO 8601)
versionIdstringnoThe version id, when the bucket has versioning
storageClassstringnoThe storage class (S3 gives none for STANDARD)
metadataobjectnoThe user metadata of the object
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "bucket": {
        "type": "string",
        "minLength": 1,
        "description": "The bucket"
      },
      "key": {
        "type": "string",
        "minLength": 1,
        "description": "The object key"
      },
      "versionId": {
        "description": "A version of the object (default: the current version)",
        "type": "string"
      }
    },
    "required": [
      "bucket",
      "key"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "exists": {
        "type": "boolean",
        "description": "False when S3 answers 404: the key or the bucket does not exist"
      },
      "contentLength": {
        "description": "The size of the object, in bytes",
        "type": "number"
      },
      "contentType": {
        "description": "The content type",
        "type": "string"
      },
      "etag": {
        "description": "The ETag of the object, without quotes",
        "type": "string"
      },
      "lastModified": {
        "description": "The time of the last change (ISO 8601)",
        "type": "string"
      },
      "versionId": {
        "description": "The version id, when the bucket has versioning",
        "type": "string"
      },
      "storageClass": {
        "description": "The storage class (S3 gives none for STANDARD)",
        "type": "string"
      },
      "metadata": {
        "description": "The user metadata of the object",
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "required": [
      "exists"
    ],
    "additionalProperties": {}
  }
}