Skip to main content

Archive & Cluster

Archive

Requires fs permission for source/destination directories.

Pack

import { archivePack } from "@luminarys/sdk-as";

const result = archivePack(
"/data/project", // source directory
"/data/project.tar.gz", // output path
"tar.gz", // format: "tar.gz" or "zip"
".git,node_modules", // exclude
);
// result.files_count, result.format

Parameters:

FieldTypeDefaultDescription
sourcestringrequiredSource directory
outputstringrequiredOutput archive path
formatstring"tar.gz"Archive format: "tar.gz" or "zip"
excludestring""Comma-separated exclude patterns

ArchivePackResult:

FieldTypeDescription
files_countintNumber of files packed
formatstringFormat used

Unpack

import { archiveUnpack } from "@luminarys/sdk-as";

const count = archiveUnpack(
"/data/project.tar.gz",
"/data/extracted",
);

Parameters:

FieldTypeDefaultDescription
archivestringrequiredArchive file path
deststringrequiredDestination directory
formatstring""Format (auto-detect by extension if empty)
excludestring""Comma-separated exclude patterns
stripint0Strip N leading path components (like tar --strip-components)

List contents

import { archiveList } from "@luminarys/sdk-as";

const entries = archiveList("/data/project.tar.gz");
for (let i = 0; i < entries.length; i++) {
// entries[i].name, entries[i].size, entries[i].is_dir
}

ArchiveEntry:

FieldTypeDescription
namestringFile or directory path within the archive
sizeintFile size in bytes (0 for directories)
is_dirboolTrue if the entry is a directory

Exclude patterns

Comma-separated, shell-like globs. Supports *, **, ?, [abc], {a,b}:

exclude: ".git,node_modules"          — skip directories by name
exclude: "*.log,*.tmp" — skip files by extension
exclude: "**/*.test.go" — skip test files at any depth
exclude: "{*.log,*.tmp}" — brace expansion
exclude: "src/**" — skip entire subdirectory
exclude: ".git,node_modules,*.log" — combined

Directory names match the entire subtree via prefix matching. Commas inside {braces} are not treated as separators. Patterns with .. are rejected for security.

Cluster

Node list

import { clusterNodeList } from "@luminarys/sdk-as";

const result = clusterNodeList();
// result.current_node — this node's ID
for (let i = 0; i < result.nodes.length; i++) {
const n = result.nodes[i];
// n.node_id, n.role, n.skills[]
}

ClusterNodeListResult:

FieldTypeDescription
current_nodestringThis node's ID
nodesClusterNodeInfo[]All known nodes

ClusterNodeInfo:

FieldTypeDescription
node_idstringNode identifier
rolestringNode role
skillsstring[]Skills registered on this node

File transfer between nodes

Requires file_transfer permission in the manifest.

import { fileTransferSend, fileTransferRecv } from "@luminarys/sdk-as";

// Send to a remote node
fileTransferSend("master", "/data/shared/result.tar.gz", "/data/result/result.tar.gz");

// Receive from a remote node
fileTransferRecv("slave-1", "/data/shared/data.csv", "/data/local/data.csv");

Permissions

permissions:
file_transfer:
enabled: true
allowed_nodes: ["master"]
local_dirs: ["/data/shared:ro"]

Example: pack and deliver

import { archivePack } from "@luminarys/sdk-as";
import { fileTransferSend } from "@luminarys/sdk-as";

// 1. Pack the project
archivePack("/data/shared/project", "/data/shared/project.tar.gz", "tar.gz", "", ".git,.venv");

// 2. Send to master node
fileTransferSend("master", "/data/shared/project.tar.gz", "/data/result/project.tar.gz");