index.js 486 B

1234567891011121314151617
  1. const path = require('node:path');
  2. const testLoadLibrary = require('./build/Release/test_module');
  3. const lib = (() => {
  4. switch (process.platform) {
  5. case 'linux':
  6. return path.resolve(__dirname, 'build/Release/foo.so');
  7. case 'darwin':
  8. return path.resolve(__dirname, 'build/Release/foo.dylib');
  9. case 'win32':
  10. return path.resolve(__dirname, 'build/Release/libfoo.dll');
  11. default:
  12. throw new Error('unsupported os');
  13. }
  14. })();
  15. testLoadLibrary(lib);