Skip to content
Talk to our solutions team

Data & Templating

Databases, JQ, Liquid templating and run variables. Each function lists its parameters, defaults and return value.

Database connection and query functions.

Scope: Network

FunctionDescription
db.connect()Establish a database connection
db.query()Execute a SQL query and return rows
db.exec()Execute a SQL statement (INSERT, UPDATE, DELETE)
db.insert()Insert rows into a table
db.update()Update rows in a table
db.delete()Delete rows from a table
db.bulk()Perform bulk insert operations
db.close()Close a database connection

Establish a database connection and return a connection handle for subsequent operations.

ParameterTypeDefaultDescription
driverstring"postgres"Database driver: "postgres", "mysql", "sqlite", "duckdb"
hoststring"localhost"Database host
portint5432Database port
databasestringDatabase name (required)
usernamestringUsername for authentication
passwordstringPassword for authentication
sslModestring"disable"SSL mode: "disable", "require", "verify-ca", "verify-full"
pathstringFile path for SQLite/DuckDB databases
readOnlyboolfalseOpen in read-only mode
FieldTypeDescription
successboolWhether connection succeeded
connectionIdstringConnection handle for subsequent operations
// Connect to PostgreSQL
let conn = db.connect({
driver: "postgres",
host: "localhost",
port: 5432,
database: "myapp",
username: "admin",
password: "secret"
})
// Connect to DuckDB
let conn = db.connect({
driver: "duckdb",
path: "/data/analytics.duckdb"
})
// Connect to SQLite (read-only)
let conn = db.connect({
driver: "sqlite",
path: "/data/app.db",
readOnly: true
})

Execute a SQL query and return rows.

ParameterTypeDefaultDescription
connectionIdstringConnection handle from db.connect() (required)
sqlstringSQL query to execute (required)
argsarrayPositional arguments for parameterized queries
namedmapNamed arguments for parameterized queries
FieldTypeDescription
successboolWhether query succeeded
rowsarrayArray of row objects
let conn = db.connect({
driver: "postgres",
database: "myapp",
username: "admin",
password: "secret"
})
// Simple query
let result = db.query({
connectionId: conn.connectionId,
sql: "SELECT id, name, email FROM users"
})
for (let row of result.rows) {
log(row.name + ": " + row.email)
}
// Parameterized query
let result = db.query({
connectionId: conn.connectionId,
sql: "SELECT * FROM users WHERE status = $1 AND age > $2",
args: ["active", 18]
})
// Named parameters
let result = db.query({
connectionId: conn.connectionId,
sql: "SELECT * FROM users WHERE department = :dept",
named: { dept: "engineering" }
})
db.close({ connectionId: conn.connectionId })

Execute a SQL statement that doesn’t return rows (INSERT, UPDATE, DELETE, DDL).

ParameterTypeDefaultDescription
connectionIdstringConnection handle (required)
sqlstringSQL statement to execute (required)
argsarrayPositional arguments
namedmapNamed arguments
FieldTypeDescription
successboolWhether execution succeeded
rowsAffectedintNumber of rows affected
lastInsertIdintLast insert ID (if applicable)
// Create a table
db.exec({
connectionId: conn.connectionId,
sql: "CREATE TABLE IF NOT EXISTS logs (id SERIAL, message TEXT, created_at TIMESTAMP DEFAULT NOW())"
})
// Insert with parameters
db.exec({
connectionId: conn.connectionId,
sql: "INSERT INTO logs (message) VALUES ($1)",
args: ["Application started"]
})
// Update with parameters
let result = db.exec({
connectionId: conn.connectionId,
sql: "UPDATE users SET status = $1 WHERE last_login < $2",
args: ["inactive", "2024-01-01"]
})
log("Updated " + result.rowsAffected + " rows")

Insert rows into a database table using a structured API.

ParameterTypeDefaultDescription
connectionIdstringConnection handle (required)
tablestringTable name (required)
columnsarrayColumn names
valuesarrayValues to insert
returningarrayColumns to return after insert (e.g., ["id"])
FieldTypeDescription
successboolWhether insert succeeded
rowsarrayReturned rows (if returning specified)
rowsAffectedintNumber of rows inserted
lastInsertIdintLast insert ID
// Insert a row
let result = db.insert({
connectionId: conn.connectionId,
table: "users",
columns: ["name", "email", "role"],
values: ["Alice", "[email protected]", "admin"],
returning: ["id"]
})
log("New user ID: " + result.rows[0].id)

Update rows in a database table.

ParameterTypeDefaultDescription
connectionIdstringConnection handle (required)
tablestringTable name (required)
setmapColumn-value pairs to update (required)
wherestringWHERE clause (without WHERE keyword)
whereArgsarrayPositional arguments for WHERE clause
returningarrayColumns to return after update
FieldTypeDescription
successboolWhether update succeeded
rowsarrayReturned rows (if returning specified)
rowsAffectedintNumber of rows updated
// Update rows
let result = db.update({
connectionId: conn.connectionId,
table: "users",
set: { status: "active", verified: true },
where: "email = $1",
whereArgs: ["[email protected]"]
})
log("Updated " + result.rowsAffected + " rows")

Delete rows from a database table.

ParameterTypeDefaultDescription
connectionIdstringConnection handle (required)
tablestringTable name (required)
wherestringWHERE clause (without WHERE keyword)
whereArgsarrayPositional arguments for WHERE clause
returningarrayColumns to return after delete
FieldTypeDescription
successboolWhether delete succeeded
rowsarrayReturned rows (if returning specified)
rowsAffectedintNumber of rows deleted
// Delete rows
let result = db.delete({
connectionId: conn.connectionId,
table: "sessions",
where: "expires_at < NOW()"
})
log("Deleted " + result.rowsAffected + " expired sessions")

Perform efficient bulk insert operations.

ParameterTypeDefaultDescription
connectionIdstringConnection handle (required)
tablestringTable name (required)
columnsarrayColumn names (required)
rowsarrayArray of arrays containing row values (required)
onConflictstringConflict handling (e.g., "DO NOTHING", "DO UPDATE SET ...")
batchSizeint1000Number of rows per batch
FieldTypeDescription
successboolWhether bulk insert succeeded
rowsAffectedintTotal rows inserted
// Bulk insert
let result = db.bulk({
connectionId: conn.connectionId,
table: "events",
columns: ["type", "payload", "timestamp"],
rows: [
["click", '{"page": "/home"}', "2024-01-15T10:00:00Z"],
["view", '{"page": "/about"}', "2024-01-15T10:01:00Z"],
["click", '{"page": "/contact"}', "2024-01-15T10:02:00Z"]
],
batchSize: 500
})
log("Inserted " + result.rowsAffected + " events")
// Upsert (insert or update on conflict)
db.bulk({
connectionId: conn.connectionId,
table: "metrics",
columns: ["name", "value"],
rows: [
["cpu_usage", 45.2],
["memory_usage", 72.1],
["disk_usage", 58.5]
],
onConflict: "DO UPDATE SET value = EXCLUDED.value"
})

Close a database connection and release resources.

ParameterTypeDefaultDescription
connectionIdstringConnection handle from db.connect() (required)
FieldTypeDescription
successboolWhether connection was closed
// Full database lifecycle
let conn = db.connect({
driver: "postgres",
database: "myapp",
username: "admin",
password: "secret"
})
let users = db.query({
connectionId: conn.connectionId,
sql: "SELECT * FROM users WHERE active = true"
})
log("Found " + users.rows.length + " active users")
db.close({ connectionId: conn.connectionId })

JQ expression evaluation functions.

Scope: System

FunctionDescription
jq.query()Evaluate a jq expression against provided data

Evaluate a jq expression against a data object. Uses the gojq library for jq-compatible query evaluation.

ParameterTypeDefaultDescription
expressionstringJQ expression to evaluate (required)
datamap{}Data object to query against
FieldTypeDescription
successboolWhether evaluation succeeded
valueanyQuery result
// Simple value extraction
let result = jq.query({
expression: ".name",
data: { name: "Alice", age: 30 }
})
log("Name: " + result.value) // "Alice"
// Count array elements
let result = jq.query({
expression: ".users | length",
data: { users: [{ name: "Alice" }, { name: "Bob" }] }
})
log("User count: " + result.value) // 2
// Filter arrays
let result = jq.query({
expression: '[.[] | select(.status == "active") | .name]',
data: [
{ name: "app1", status: "active" },
{ name: "app2", status: "inactive" },
{ name: "app3", status: "active" }
]
})
log("Active: " + JSON.stringify(result.value)) // ["app1", "app3"]
// Extract nested values
let result = jq.query({
expression: ".config.database.host",
data: {
config: {
database: { host: "localhost", port: 5432 }
}
}
})
log("DB host: " + result.value) // "localhost"
// Build new objects
let result = jq.query({
expression: "{ host: .db_host, port: .db_port }",
data: { db_host: "localhost", db_port: 5432, db_name: "myapp" }
})
log(JSON.stringify(result.value)) // {"host":"localhost","port":5432}
// Transform data
let result = jq.query({
expression: '[.items[] | {name, total: (.price * .quantity)}]',
data: {
items: [
{ name: "Widget", price: 10, quantity: 5 },
{ name: "Gadget", price: 25, quantity: 2 }
]
}
})
log(JSON.stringify(result.value))
// Parse JSON strings
let result = jq.query({
expression: ".config | fromjson | .port",
data: { config: '{"host":"localhost","port":8080}' }
})
log("Port: " + result.value) // 8080

Liquid template rendering functions.

Scope: System

FunctionDescription
liquid.render()Render a Liquid template with variables
liquid.process()Process Liquid templates from a source directory

Render a Liquid template string or file with provided variables.

ParameterTypeDefaultDescription
datastringInline template string
filestringPath to template file (alternative to data)
pathstringBase path for {% include %} tags
varsmapVariables to pass to the template

Either data or file must be provided.

FieldTypeDescription
successboolWhether rendering succeeded
outputstringRendered output
// Render inline template
let result = liquid.render({
data: "Hello, {{name}}! You have {{count}} items.",
vars: { name: "Alice", count: 42 }
})
log(result.output) // "Hello, Alice! You have 42 items."
// Render with conditionals
let result = liquid.render({
data: `
{% if environment == "production" %}
server: prod.example.com
{% else %}
server: dev.example.com
{% endif %}
`,
vars: { environment: "production" }
})
log(result.output)
// Render from file
let result = liquid.render({
file: "/templates/config.yaml.liquid",
vars: {
host: "localhost",
port: 8080,
debug: false
}
})
file.write({ path: "/config/config.yaml", content: result.output })
// Render with loops
let result = liquid.render({
data: "{% for item in items %}{{item.name}}: {{item.value}}\n{% endfor %}",
vars: {
items: [
{ name: "cpu", value: "45%" },
{ name: "memory", value: "72%" }
]
}
})
log(result.output)

Process Liquid templates from a source directory to a destination directory.

ParameterTypeDefaultDescription
sourcestringSource directory containing templates (required)
destinationstringOutput directory for rendered files (required)
includearrayGlob patterns to include
excludearrayGlob patterns to exclude
flattenboolfalseFlatten directory structure in output
varsmapVariables to pass to all templates
FieldTypeDescription
successboolWhether processing succeeded
processedintNumber of files processed
// Process all templates in a directory
let result = liquid.process({
source: "/templates/kubernetes/",
destination: "/output/k8s/",
vars: {
namespace: "production",
replicas: 3,
image: "myapp:v1.0"
}
})
log("Processed " + result.processed + " templates")
// Process with include/exclude filters
liquid.process({
source: "/templates/",
destination: "/output/",
include: ["*.yaml", "*.conf"],
exclude: ["*.bak", "test-*"],
vars: { environment: "staging" }
})
// Flatten directory structure
liquid.process({
source: "/templates/nested/config/",
destination: "/output/flat/",
flatten: true,
vars: { host: "localhost" }
})

Workflow variable functions.

Scope: System

FunctionDescription
vars.set()Set workflow variables from a map
vars.readFile()Read file contents into variables
vars.readGlob()Read files matching a glob pattern into a map variable

Set workflow variables from a map of key-value pairs.

ParameterTypeDefaultDescription
varsmapMap of variable name → value (required)
FieldTypeDescription
successboolWhether variables were set
contextmapMap of set variables
// Set multiple variables
vars.set({
vars: {
environment: "production",
version: "1.0.0",
replicas: 3
}
})
// Set computed variables
let timestamp = new Date().toISOString()
vars.set({
vars: {
build_time: timestamp,
build_id: "build-" + Date.now()
}
})

Read file contents into workflow variables. Supports single file or multiple files.

ParameterTypeDefaultDescription
pathstringFile path to read (required)
setvarstring"content"Variable name to store content
ParameterTypeDefaultDescription
filesmapMap of variable name → file path
FieldTypeDescription
successboolWhether read succeeded
contextmapMap of variable name → file content
// Read a single file
let result = vars.readFile({
path: "/config/settings.yaml",
setvar: "config"
})
log("Config: " + result.context.config)
// Read multiple files
let result = vars.readFile({
files: {
cert: "/etc/ssl/cert.pem",
key: "/etc/ssl/key.pem",
ca: "/etc/ssl/ca.pem"
}
})
log("Cert loaded: " + result.context.cert.substring(0, 30))
log("Key loaded: " + result.context.key.substring(0, 30))

Read files matching a glob pattern into a map variable. Each matching file becomes a key-value entry (filepath → content).

ParameterTypeDefaultDescription
patternstringGlob pattern to match files (required)
setvarstring"files"Variable name to store result map
ParameterTypeDefaultDescription
globsmapMap of variable name → glob pattern
FieldTypeDescription
successboolWhether read succeeded
contextmapMap of variable name → map of filepath → content
// Read all YAML config files
let result = vars.readGlob({
pattern: "/config/*.yaml",
setvar: "configs"
})
log("Loaded " + Object.keys(result.context.configs).length + " config files")
// Read multiple glob patterns
let result = vars.readGlob({
globs: {
templates: "/templates/*.liquid",
configs: "/config/*.yaml",
scripts: "/scripts/*.sh"
}
})
log("Templates: " + Object.keys(result.context.templates).length)
log("Configs: " + Object.keys(result.context.configs).length)

Numeric and string computation functions.

Scope: System

FunctionDescription
compute.sum()Add two numeric values
compute.concat()Concatenate two strings
compute.replicate()Create a deep copy of a record

Add two numeric values together.

ParameterTypeDefaultDescription
valuenumberBase value (required)
addnumberValue to add (required)
FieldTypeDescription
successboolWhether the computation succeeded
resultnumberSum of the two values
errorstringError message if failed
// Add two numeric values
var result = compute.sum({ value: 42, add: 8 });
if (result.success) {
console.log(result.result); // 50
}

Concatenate two strings together.

ParameterTypeDefaultDescription
valuestringBase string (required)
addstringString to concatenate (required)
FieldTypeDescription
successboolWhether the computation succeeded
resultstringConcatenated string
errorstringError message if failed
// Concatenate two strings
var result = compute.concat({ value: "Hello", add: " World" });
if (result.success) {
console.log(result.result); // "Hello World"
}

Create a deep copy of a record (key-value map).

ParameterTypeDefaultDescription
recordmapRecord to replicate (required)
FieldTypeDescription
successboolWhether the replication succeeded
resultmapDeep copy of the input record
errorstringError message if failed
// Create a deep copy of a record
var result = compute.replicate({
record: { name: "Alice", age: 30, role: "admin" }
});
if (result.success) {
var copy = result.result;
console.log(copy.name); // "Alice"
}

Multi-field aggregation computations.

Scope: System

FunctionDescription
aggregate.compute()Compute aggregate operations (sum, avg, min, max, count) on a set of records

Perform multiple aggregate operations across multiple fields on an array of records. Returns a single result map with keys named {field}_{op}.

ParameterTypeDefaultDescription
fieldslistList of field specifications (required)
fields[].fieldstringField name to aggregate
fields[].opslistOperations to apply: sum, avg, min, max, count
recordslistList of key-value maps representing records (required)
FieldTypeDescription
successboolWhether the computation succeeded
resultmapAggregated values keyed as {field}_{op}, plus count (total records)
errorstringError message if failed
// Compute sum and average of amounts
var result = aggregate.compute({
fields: [
{ field: "amount", ops: ["sum", "avg", "min", "max"] },
{ field: "quantity", ops: ["sum"] }
],
records: [
{ amount: 100, quantity: 5 },
{ amount: 200, quantity: 3 },
{ amount: 150, quantity: 8 }
]
});
// result.result = { amount_sum: 450, amount_avg: 150, amount_min: 100,
// amount_max: 200, quantity_sum: 16, count: 3 }
// Read CSV and aggregate in one script
var data = csv.read({ path: "/data/sales.csv" });
if (data.success) {
var stats = aggregate.compute({
fields: [
{ field: "revenue", ops: ["sum", "avg"] },
{ field: "units", ops: ["sum", "min", "max"] }
],
records: data.records
});
if (stats.success) {
console.log("Total revenue: " + stats.result.revenue_sum);
console.log("Avg revenue: " + stats.result.revenue_avg);
console.log("Total units: " + stats.result.units_sum);
}
}
function main(input)
local result = aggregate.compute({
fields = {
{ field = "score", ops = {"avg", "min", "max"} }
},
records = {
{ score = 85 },
{ score = 92 },
{ score = 78 }
}
})
return result.result
end

Read and write CSV files.

Scope: System

FunctionDescription
csv.read()Read a CSV file into an array of records
csv.write()Write records to a CSV file

Read a CSV file and return all rows as key-value records. The first row is used as the header.

ParameterTypeDefaultDescription
pathstringCSV file path (required)
FieldTypeDescription
successboolWhether the read succeeded
recordsarrayArray of key-value maps (one per row)
errorstringError message if failed
// Read a CSV file
var result = csv.read({
path: "/data/users.csv"
});
if (result.success) {
for (var i = 0; i < result.records.length; i++) {
console.log(result.records[i].name + ": " + result.records[i].email);
}
}

Write an array of key-value records to a CSV file.

ParameterTypeDefaultDescription
pathstringOutput CSV file path (required)
recordsarrayArray of key-value maps to write (required)
headerslistColumn headers (inferred from first record if omitted)
overwriteboolfalseTruncate file before writing (vs append)
FieldTypeDescription
successboolWhether the write succeeded
countintNumber of records written
errorstringError message if failed
// Write records to a CSV file
var result = csv.write({
path: "/output/data.csv",
records: [
{ name: "Alice", age: "30" },
{ name: "Bob", age: "25" }
],
overwrite: true
});
if (result.success) {
console.log("Wrote " + result.count + " records");
}
// Read, transform, and write CSV
var data = csv.read({ path: "/data/input.csv" });
if (data.success) {
var transformed = [];
for (var i = 0; i < data.records.length; i++) {
var r = data.records[i];
transformed.push({
full_name: r.first_name + " " + r.last_name,
email: r.email
});
}
csv.write({
path: "/data/output.csv",
records: transformed,
overwrite: true
});
}

Read and write Excel spreadsheet files.

Scope: System

FunctionDescription
excel.read()Read an Excel file into an array of records
excel.write()Write records to an Excel file

Read an Excel spreadsheet and return all rows as key-value records. The first row of each sheet is used as the header.

ParameterTypeDefaultDescription
pathstringExcel file path (required)
sheetstringSheet name (reads all sheets if omitted)
FieldTypeDescription
successboolWhether the read succeeded
recordsarrayArray of key-value maps (one per row)
errorstringError message if failed
// Read records from an Excel file
var result = excel.read({ path: "/data/report.xlsx", sheet: "Sales" });
if (result.success) {
for (var i = 0; i < result.records.length; i++) {
console.log(result.records[i].product + ": " + result.records[i].amount);
}
}

Write an array of key-value records to an Excel spreadsheet.

ParameterTypeDefaultDescription
pathstringOutput Excel file path (required)
sheetstringSheet name
recordsarrayArray of key-value maps to write (required)
overwriteboolfalseCreate new file (vs append to existing)
FieldTypeDescription
successboolWhether the write succeeded
countintNumber of records written
errorstringError message if failed
// Write records to an Excel file
var result = excel.write({
path: "/output/report.xlsx",
sheet: "Results",
records: [
{ name: "Alice", score: "95" },
{ name: "Bob", score: "87" }
],
overwrite: true
});
if (result.success) {
console.log("Wrote " + result.count + " records");
}

Read and write Apache Parquet files.

Scope: System

FunctionDescription
parquet.read()Read a Parquet file into an array of records
parquet.write()Write records to a Parquet file

Read an Apache Parquet file and return all rows as key-value records. All values are converted to strings.

ParameterTypeDefaultDescription
pathstringParquet file path (required)
FieldTypeDescription
successboolWhether the read succeeded
recordsarrayArray of key-value maps (one per row)
errorstringError message if failed
// Read records from a Parquet file
var result = parquet.read({ path: "/data/events.parquet" });
if (result.success) {
for (var i = 0; i < result.records.length; i++) {
console.log(JSON.stringify(result.records[i]));
}
}

Write an array of key-value records to an Apache Parquet file. All fields are written as strings.

ParameterTypeDefaultDescription
pathstringOutput Parquet file path (required)
recordsarrayArray of key-value maps to write (required)
FieldTypeDescription
successboolWhether the write succeeded
countintNumber of records written
errorstringError message if failed
// Write records to a Parquet file
var result = parquet.write({
path: "/output/data.parquet",
records: [
{ id: "1", name: "Alice" },
{ id: "2", name: "Bob" }
]
});
if (result.success) {
console.log("Wrote " + result.count + " records");
}

Query and mutate Data API entity stores.

Scope: System

Note: All entity functions require a pipeline environment with Data API EntityManager. The namespace functions are stubs in Script standalone mode and return errors directing to the YAML pipeline interface.

FunctionDescription
entity.query()Query records from an entity store
entity.mutate()Write records to an entity store

Query records from a Data API entity store.

ParameterTypeDefaultDescription
fileslistEntity definition file paths
dbpoolmapDatabase pool configuration
datastorestringDatastore name (alternative to files/dbpool)
querystringEntity query to execute (required)
FieldTypeDescription
successboolWhether the query succeeded
recordsarrayArray of entity records
errorstringError message (stub always returns error)
// Entity queries are not available in Script standalone mode.
// Use the YAML pipeline interface (readentity or readentity-in-datastore) instead.
var result = entity.query({
files: ["/schemas/user.yaml"],
dbpool: {},
query: "SELECT * FROM user"
});
// result = { success: false, error: "entity operations require pipeline environment" }

Write records to a Data API entity store via bulk mutation.

ParameterTypeDefaultDescription
datastorestringDatastore name (required)
recordmapEntity record data (required)
FieldTypeDescription
successboolWhether the mutation succeeded
errorstringError message (stub always returns error)
// Entity mutations are not available in Script standalone mode.
// Use the YAML pipeline interface (writeentity-in-datastore) instead.
var result = entity.mutate({
datastore: "customer-db",
record: { id: "1", name: "Alice" }
});
// result = { success: false, error: "entity operations require pipeline environment" }

Execute inline morph scripts with multi-language support.

Scope: System

FunctionDescription
morph.execute()Run a morph script inline with specified language and input

Execute a morph script from within another Script script. The target script must define a morph(input) function. Enables nested script execution for dynamically generating transformation code or running user-provided scripts.

ParameterTypeDefaultDescription
languagestringjavascriptScript language: javascript, js, lua, starlark, javascript-v8, v8
codestringScript source defining a morph(input) function (required)
inputanyInput data passed to the morph function
FieldTypeDescription
successboolWhether the execution succeeded
resultanyReturn value from the morph function
errorstringError message if failed
// Execute a JavaScript morph inline
var result = morph.execute({
language: "javascript",
code: 'function morph(input) { return input.x * 2; }',
input: { x: 21 }
});
// result = { success: true, result: 42 }
// Execute a Lua morph from JavaScript
var result = morph.execute({
language: "lua",
code: 'function morph(input) return input.name .. " processed" end',
input: { name: "Alice" }
});
// result = { success: true, result: "Alice processed" }
// Combine csv.read + morph.execute for dynamic processing
var data = csv.read({ path: "/data/records.csv" });
if (data.success) {
var transformCode = 'function morph(input) { return { upper: input.name.toUpperCase(), len: input.name.length }; }';
for (var i = 0; i < data.records.length; i++) {
var transformed = morph.execute({
code: transformCode,
input: data.records[i]
});
console.log(JSON.stringify(transformed.result));
}
}

Execute shell commands and parse CSV output.

Scope: System

FunctionDescription
stdout.exec()Execute a command and parse its CSV output into records

Execute a shell command and parse its stdout as CSV into key-value records. The first line of output is used as the header.

ParameterTypeDefaultDescription
commandstringShell command to execute (required)
FieldTypeDescription
successboolWhether the execution succeeded
recordsarrayArray of key-value maps parsed from CSV output
outputstringRaw command output
errorstringError message if failed
// Execute a command and parse CSV output
var result = stdout.exec({
command: "echo 'name,age\nAlice,30\nBob,25'"
});
if (result.success) {
for (var i = 0; i < result.records.length; i++) {
console.log(result.records[i].name + " is " + result.records[i].age);
}
}
// Read system process list
var result = stdout.exec({
command: "ps aux --no-headers | awk '{print $1\",\"$2\",\"$11}'"
});
if (result.success) {
console.log("Found " + result.records.length + " processes");
}