MCPcopy
hub / github.com/mongodb/node-mongodb-native / getZstdLibrary

Function getZstdLibrary

src/deps.ts:63–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61export type ZStandard = ZStandardLib | { kModuleError: MongoMissingDependencyError };
62
63export 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

Callers 1

loadZstdFunction · 0.90

Calls 1

makeErrorModuleFunction · 0.85

Tested by

no test coverage detected