Upload Raw Data File
Upload a file to an existing raw data record using the Knowledgator TypeScript SDK.
Example Usage
import { createClient } from '@knowledgator/typescript-sdk';
import { readFile } from 'fs/promises';
const kg = createClient('YOUR_API_KEY');
const fileBuffer = await readFile('./corpus.txt');
const response = await kg.datasets.uploadData('your-raw-data-id', {
file: new Uint8Array(fileBuffer),
filename: 'corpus.txt'
});
console.log('Upload result:', response);
Method Parameters
kg.datasets.uploadData(dataId, request)
| Parameter | Type | Required | Description |
|---|---|---|---|
dataId | string | Yes | Target raw data item identifier. |
request.file | Uint8Array | Buffer | Blob | Yes | Raw binary content to upload. |
request.filename | string | No | Original filename (e.g. 'corpus.txt'). |