* @description Creates a new ModuleClient instance. * @param {ModuleClientOptions} [options] - Configuration options for the ModuleClient * @example const module = new ModuleClient(); * @example const module = new ModuleClient({ customLibraryPath: '/path/to/tls-library' });
(options?: ModuleClientOptions)
| 55 | * @example const module = new ModuleClient({ customLibraryPath: '/path/to/tls-library' }); |
| 56 | */ |
| 57 | constructor(options?: ModuleClientOptions) { |
| 58 | this.customPath = options?.customLibraryPath ? true : false; |
| 59 | this.tlsDependency = new TlsDependency(); |
| 60 | this.tlsDependencyPath = this.tlsDependency.getTLSDependencyPath(options?.customLibraryDownloadPath); |
| 61 | const libPath = this.customPath ? options?.customLibraryPath : this.tlsDependencyPath?.TLS_LIB_PATH; |
| 62 | if (!libPath) { |
| 63 | throw new Error('TLS library path not available'); |
| 64 | } |
| 65 | this.TLS_LIB_PATH = libPath; |
| 66 | this.maxThreads = options?.maxThreads ?? Math.max(os.cpus()?.length ?? 12, 1) * 2; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @description Checks if the TLS library exists. |
nothing calls this directly
no test coverage detected