igir
Version:
🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.
23 lines (22 loc) • 818 B
TypeScript
import File from './types/files/file.js';
/**
* Wrapper for an `async-mutex` {@link Semaphore} that limits how many files can be processed at
* once per hard drive.
*/
export default class DriveSemaphore {
private readonly driveSemaphores;
private readonly driveSemaphoresMutex;
private readonly threadsSemaphore;
constructor(threads: number);
getValue(): number;
setValue(threads: number): void;
/**
* Run a {@link runnable} exclusively for the given {@link file}.
*/
runExclusive<V>(file: File | string, runnable: () => V | Promise<V>): Promise<V>;
/**
* Run some {@link runnable} for every value in {@link files}.
*/
map<K extends File | string, V>(files: K[], runnable: (file: K) => V | Promise<V>): Promise<V[]>;
private static getDiskForFile;
}