INNER CODE UNIT · JavaScript

saveToJSON

cporter202/agentic-ai-apis · settings/fetch_apify_actors.js:109

function saveToJSON(actors, filename = 'apify_actors.json') {
    const filePath = path.join(__dirname, '..', filename);
    fs.writeFileSync(filePath, JSON.stringify(actors, null, 2), 'utf-8');
    console.log(`Saved ${actors.length} actors to ${filename}`);
}

async function main() {
    console.log('='.repeat(60));
    console.log('Apify Actors Fetcher');
    console.log('='.repeat(60));

    try {
        const actors = await fetchAllActors(100);

        if (actors.length === 0) {
            console.log('No actors were fetched. Please check the API connection.');
            return;
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…