博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Electron如何调用NodeJS扩展模块
阅读量:2390 次
发布时间:2019-05-10

本文共 861 字,大约阅读时间需要 2 分钟。

如何准备Electron

http://blog.csdn.net/chenhaifeng2016/article/details/74917361

如何开发一个NodeJS第三方模块

http://blog.csdn.net/chenhaifeng2016/article/details/74939493

NodeJS第三方模块要用于Electron需要重新编译。

修改第三方模块的配置文件package.json

{  "name": "facerecognitiondll",  "version": "1.0.0",  "description": "",  "main": "main.js",  "scripts": {    "install": "node-gyp rebuild -target=1.6.11 -arch=x64 -dist-url=https://atom.io/download/atom-shell"  },  "author": "",  "license": "ISC",  "gypfile": true}
生成模块

npm install

创建文件main.js导出模块

const facerecognitiondll = require('./build/Release/facerecognitiondll');exports.CAMOpen = facerecognitiondll.CAMOpen;
通过npm install facerecognitiondll安装此模块到本地nodes_modules目录。

修改index.html

    
人脸识别测试程序

运行npm start

项目结构

参考资料

https://github.com/electron/electron/blob/master/docs-translations/zh-CN/tutorial/using-native-node-modules.md

你可能感兴趣的文章
全面解析Linux内核的同步与互斥机制--同步篇
查看>>
C语言里面的嵌套声明的读法
查看>>
kmalloc详解
查看>>
linux下gdb单步调试(中)
查看>>
写一个块设备驱动-第9章
查看>>
JDBC数据库开发技术
查看>>
oracle表分区详解
查看>>
从头做leetcode之leetcode 5 最长回文子串
查看>>
从头做leetcode之leetcode 6 Z字形变换
查看>>
将无符号偏移量添加到...溢出到...
查看>>
从头做leetcode之leetcode 11 盛最多水的容器
查看>>
设计模式、框架和架构的联系
查看>>
安装VMware虚拟机
查看>>
常用的设计模式和代码
查看>>
桥接模式-通俗的理解(转)
查看>>
MXML 文件中的xmlns是什么意思?
查看>>
Flex Builder 中的工作空间、项目
查看>>
Flex 获得远程数据
查看>>
Flex 添加效果的两种方法
查看>>
Flash Builder 4字体设置
查看>>