@llamaindex/semtools
Version:
Semantic search and document parsing tools for the command line (Rust-backed, npm-distributed)
18 lines (13 loc) • 576 B
JavaScript
const { spawn } = require('node:child_process');
const { join } = require('node:path');
const { existsSync } = require('node:fs');
const isWindows = process.platform === 'win32';
const exe = isWindows ? '.exe' : '';
const localPath = join(__dirname, '..', 'dist', 'bin', `search${exe}`);
const bin = existsSync(localPath) ? localPath : 'search';
const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit', shell: isWindows });
child.on('exit', (code, signal) => {
if (signal) process.kill(process.pid, signal);
process.exit(code ?? 1);
});