flock-binding.js 625 B

123456789101112
  1. /** Load the private callback API to test native completion independently of its Promise wrapper. */
  2. import { createRequire } from 'node:module';
  3. import { fileURLToPath } from 'node:url';
  4. /** @returns The built addon's private callback binding for this host. */
  5. export function loadFlockBinding() {
  6. const libc = process.platform === 'linux'
  7. ? `${process.report.getReport().header.glibcVersionRuntime ? 'glibc' : 'musl'}/`
  8. : '';
  9. const binary = new URL(`../../packages/${process.platform}-${process.arch}/bin/${libc}system.node`, import.meta.url);
  10. return createRequire(import.meta.url)(fileURLToPath(binary));
  11. }