Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ollm/opencomic-ai-bin/llms.txt

Use this file to discover all available pages before exploring further.

Immediately closes all active daemon processes and clears the daemon pool. This is useful for manual cleanup or when shutting down your application.

Syntax

OpenComicAI.closeAllDaemons(): void

Parameters

This method takes no parameters.

Returns

void - This method does not return a value.

Behavior

  • Closes all active daemon processes immediately
  • Clears the internal daemon pool completely
  • Does not wait for ongoing operations to complete
  • Frees all memory used by daemon processes
  • Safe to call even if no daemons are running

Example

import OpenComicAI from '@opencomic/ai-bin';

// Process multiple images with daemon mode
for (const image of images) {
  await OpenComicAI.upscale({
    input: image,
    output: `upscaled-${image}`,
    daemonMode: true
  });
}

// Clean up all daemons when done
OpenComicAI.closeAllDaemons();

Use cases

Application shutdown

process.on('SIGINT', () => {
  console.log('Shutting down...');
  OpenComicAI.closeAllDaemons();
  process.exit(0);
});

After batch processing

async function processBatch(images) {
  try {
    for (const image of images) {
      await OpenComicAI.upscale({
        input: image,
        output: `upscaled-${image}`,
        daemonMode: true
      });
    }
  } finally {
    // Ensure cleanup even if errors occur
    OpenComicAI.closeAllDaemons();
  }
}

Memory management

// Process large batches with periodic cleanup
for (let i = 0; i < largeImageArray.length; i++) {
  await OpenComicAI.upscale({
    input: largeImageArray[i],
    output: `upscaled-${i}.jpg`,
    daemonMode: true
  });
  
  // Close daemons every 100 images to manage memory
  if (i % 100 === 0) {
    OpenComicAI.closeAllDaemons();
  }
}

Important notes

  • Does not interrupt currently processing images
  • Daemons will be recreated automatically on next upscale operation
  • Use this for explicit cleanup; daemons also close automatically based on idle timeout

Source

Defined in index.mts:787-797