Skip to content

Commit 12e2a54

Browse files
committed
fix: load native prebuilds explicitly
1 parent 3182392 commit 12e2a54

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

index.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22
* Created by tdzl2003 on 2/28/16.
33
*/
44

5-
var native = require('node-gyp-build')(__dirname);
5+
function loadNative() {
6+
var platform = process.platform;
7+
var arch = process.arch;
8+
9+
if (platform === 'darwin' && arch === 'arm64') {
10+
return require('./prebuilds/darwin-arm64/node-bsdiff.node');
11+
}
12+
if (platform === 'linux' && arch === 'x64') {
13+
return require('./prebuilds/linux-x64/node-bsdiff.node');
14+
}
15+
if (platform === 'linux' && arch === 'arm64') {
16+
return require('./prebuilds/linux-arm64/node-bsdiff.node');
17+
}
18+
19+
return require('node-gyp-build')(__dirname);
20+
}
21+
22+
var native = loadNative();
623
exports.native = native;
724

825
function byteLength(value) {

0 commit comments

Comments
 (0)