()
| 61 | export type ZStandard = ZStandardLib | { kModuleError: MongoMissingDependencyError }; |
| 62 | |
| 63 | export function getZstdLibrary(): ZStandardLib | { kModuleError: MongoMissingDependencyError } { |
| 64 | let ZStandard: ZStandardLib | { kModuleError: MongoMissingDependencyError }; |
| 65 | try { |
| 66 | // eslint-disable-next-line @typescript-eslint/no-require-imports |
| 67 | ZStandard = require('@mongodb-js/zstd'); |
| 68 | } catch (error) { |
| 69 | ZStandard = makeErrorModule( |
| 70 | new MongoMissingDependencyError( |
| 71 | 'Optional module `@mongodb-js/zstd` not found. Please install it to enable zstd compression', |
| 72 | { cause: error, dependencyName: 'zstd' } |
| 73 | ) |
| 74 | ); |
| 75 | } |
| 76 | |
| 77 | return ZStandard; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @public |
no test coverage detected