dev: update dev script for auto-download
All checks were successful
pipeline / lint-and-format (push) Successful in 4m16s
pipeline / build-and-push-images (push) Successful in 47s

This commit is contained in:
2026-02-05 14:28:20 +01:00
parent 50bd0d216d
commit 564de90ecb
4 changed files with 100 additions and 35 deletions

View File

@@ -1,10 +1,14 @@
#!/usr/bin/env node
const { MongoClient, ObjectId } = require('mongodb');
const fs = require('fs');
const { createReadStream } = require('fs');
const { createInterface } = require('readline');
const path = require('path');
import { MongoClient, ObjectId } from 'mongodb';
import fs from 'fs';
import { createReadStream } from 'fs';
import { createInterface } from 'readline';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/**
* Stream-based import of large JSON files
@@ -121,7 +125,7 @@ async function importLargeJsonFile(filePath, collectionName, batchSize = 1000) {
}
// Run the import if called directly
if (require.main === module) {
if (import.meta.url === `file://${process.argv[1]}`) {
const args = process.argv.slice(2);
if (args.length < 2) {
console.log('Usage: node process-matches.js <file-path> <collection-name> [batch-size]');
@@ -141,4 +145,4 @@ if (require.main === module) {
});
}
module.exports = { importLargeJsonFile };
export { importLargeJsonFile };