useDatasets
List, upload, download, and delete datasets, with reactive loading and error state.
import { useDatasets } from 'flowstack-sdk'Dataset operations.
Signature
const { datasets, isLoading, error, uploadDataset, downloadDataset, deleteDataset, refreshDatasets } = useDatasets()Returns
| Field | Type | Description |
|---|---|---|
datasets | DatasetInfo[] | Datasets, each { id, name, rows, columns, schema?, columnNames?, createdAt?, updatedAt? }. |
isLoading | boolean | Fetch in flight. |
error | string | null | Last error message. |
uploadDataset | (file, name?) => Promise<DatasetInfo | null> | Upload a dataset file, optionally naming it. |
downloadDataset | (name) => Promise<Blob | null> | Download a dataset by name. |
deleteDataset | (name) => Promise<boolean> | Delete a dataset by name. |
refreshDatasets | () => Promise<void> | Manual re-fetch. |
Examples
const {
datasets, // DatasetInfo[] — { id, name, rows, columns, schema?, columnNames?, createdAt?, updatedAt? }
isLoading, // boolean
error, // string | null
uploadDataset, // (file, name?) => Promise<DatasetInfo | null>
downloadDataset, // (name) => Promise<Blob | null>
deleteDataset, // (name) => Promise<boolean>
refreshDatasets, // () => Promise<void>
} = useDatasets();NoteDatasetInfo fields (source of truth:
src/types/index.ts): id: string — stable identifier; name: string — user-visible name; rows: number — row count (NOT rowCount); columns: number — column count (NOT columnCount); schema?: Record<string, ColumnSchema> — optional per-column schema; columnNames?: string[] — optional ordered column names; createdAt?: string, updatedAt?: string — ISO8601 timestamps.See also
useCollection · useVisualizations · useReports · useDataSources · useQuery
Source: README.md#usedatasets · Also available in llms-full.txt and registry.json.