← All procedures

s3.download

Download content from S3 bucket

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

Use it

In TypeScript

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

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

From the command line

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

As data, in a program

{
  "$proc": ["s3", "download"],
  "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
destPathstringnoWrite the object to this file instead of returning it (streams to disk: no size limit, no base64)
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, empty with destPath
pathstringnoThe file that holds the object, with destPath
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"
      },
      "destPath": {
        "description": "Write the object to this file instead of returning it (streams to disk: no size limit, no base64)",
        "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, empty with destPath"
      },
      "path": {
        "description": "The file that holds the object, with destPath",
        "type": "string"
      },
      "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": {}
  }
}