← All procedures

s3.read

Read an S3 object into memory, with a size limit (maxBytes, 64 MiB by default)

CLI
Package
@procedures/s3 · README
Path
["s3","read"]
CLI
mark s3 read --bucket <string> --key <string>
As data
{"$proc":["s3","read"],"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","read"], { bucket: "<bucket>", key: "<key>" });
console.log(JSON.stringify(result));

From the command line

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

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
bucketstringyesS3 bucket name
keystringyesObject key (path in bucket)
encodingstringnoEncoding for text content (utf8, ascii, etc.) - omit for base64 binary
versionIdstringnoSpecific version to download
maxBytesintegernoLargest object to load into memory when destPath is not set (default: 64 MiB)

Output

FieldTypeRequiredDefaultDescription
bodystringyesThe content: text with an encoding, base64 without one
contentLengthnumberyesThe size of the object, in bytes
contentTypestringnoThe content type
etagstringnoThe ETag of the object, without quotes
lastModifiedstringnoThe time of the last change (ISO 8601)
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "bucket": {
        "type": "string",
        "description": "S3 bucket name"
      },
      "key": {
        "type": "string",
        "description": "Object key (path in bucket)"
      },
      "encoding": {
        "description": "Encoding for text content (utf8, ascii, etc.) - omit for base64 binary",
        "type": "string"
      },
      "versionId": {
        "description": "Specific version to download",
        "type": "string"
      },
      "maxBytes": {
        "description": "Largest object to load into memory when destPath is not set (default: 64 MiB)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "bucket",
      "key"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "body": {
        "type": "string",
        "description": "The content: text with an encoding, base64 without one"
      },
      "contentLength": {
        "type": "number",
        "description": "The size of the object, in bytes"
      },
      "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"
      }
    },
    "required": [
      "body",
      "contentLength"
    ],
    "additionalProperties": {}
  }
}