in packages/azure-kusto-ingest/example.js [101:128]
async function startStreamingIngestion() {
// Ingest from file with either file path or FileDescriptor
try {
await streamingIngestClient.ingestFromFile("file.json", props2);
console.log("Ingestion done");
} catch (err) {
console.log(err);
}
// Ingest from stream with either ReadStream or StreamDescriptor
let stream = fs.createReadStream("file.json");
try {
await streamingIngestClient.ingestFromStream(stream, props2);
console.log("Ingestion done");
} catch (err) {
console.log(err);
}
// For gzip data set StreamDescriptor.compressionType to CompressionType.GZIP
stream = fs.createReadStream("file.json.gz");
const streamDescriptor = new StreamDescriptor(stream, "id", CompressionType.GZIP);
try {
await streamingIngestClient.ingestFromStream(streamDescriptor, props2);
console.log("Ingestion done");
} catch (err) {
console.log(err);
}
}