Skip to content
Get started

Create volume from archive

client.volumes.createFromArchive("string" | "ArrayBuffer" | "ArrayBufferView" | 2 morebody, VolumeCreateFromArchiveParams { name, size_gb, id } params, RequestOptionsoptions?): Volume { id, created_at, name, 2 more }
post/volumes/from-archive

Creates a new volume pre-populated with content from a tar.gz archive. The archive is streamed directly into the volume's root directory.

ParametersExpand Collapse
body: "string" | "ArrayBuffer" | "ArrayBufferView" | 2 more
formatbinary
params: VolumeCreateFromArchiveParams { name, size_gb, id }
name: string

Query param: Volume name

size_gb: number

Query param: Maximum size in GB (extraction fails if content exceeds this)

id?: string

Query param: Optional custom volume ID (auto-generated if not provided)

ReturnsExpand Collapse
Volume { id, created_at, name, 2 more }
id: string

Unique identifier

created_at: string

Creation timestamp (RFC3339)

formatdate-time
name: string

Volume name

size_gb: number

Size in gigabytes

attachments?: Array<VolumeAttachment { instance_id, mount_path, readonly } >

List of current attachments (empty if not attached)

instance_id: string

ID of the instance this volume is attached to

mount_path: string

Mount path in the guest

readonly: boolean

Whether the attachment is read-only

Create volume from archive
import Hypeman from '@onkernel/hypeman';

const client = new Hypeman({
  apiKey: 'My API Key',
});

const volume = await client.volumes.createFromArchive(fs.createReadStream('path/to/file'), {
  name: 'name',
  size_gb: 0,
});

console.log(volume.id);
{
  "id": "vol-data-1",
  "created_at": "2025-01-15T09:00:00Z",
  "name": "my-data-volume",
  "size_gb": 10,
  "attachments": [
    {
      "instance_id": "inst-abc123",
      "mount_path": "/mnt/data",
      "readonly": false
    }
  ]
}
Returns Examples
{
  "id": "vol-data-1",
  "created_at": "2025-01-15T09:00:00Z",
  "name": "my-data-volume",
  "size_gb": 10,
  "attachments": [
    {
      "instance_id": "inst-abc123",
      "mount_path": "/mnt/data",
      "readonly": false
    }
  ]
}