简体   繁体   English

如何在应用程序中使用.Node文件

[英]How do I use .Node files in my Application

I want to use lwip in my node application. 我想在节点应用程序中使用lwip But when I tried npm install lwip , it failed on in my environment. 但是当我尝试npm install lwip ,它在我的环境中失败了。 So, I followed instructions on the github page, I have the project built for my environment. 因此,我按照github页面上的说明进行操作,我已经为我的环境构建了项目。 The output of which is three .Node files: lwip_decoder, lwip_encoder, and lwip_image. 其输出是三个.Node文件:lwip_decoder,lwip_encoder和lwip_image。 how do I use these within my application? 如何在应用程序中使用它们?

I have this but I keep getting an error that .open is undefined 我有这个但我不断收到错误消息.open是未定义的

var lwip = require('../../custom_modules/lwip_image');
var img = req.files.image;
var imgPath = path.join(__dirname, '../../public/images', img.name);
lwip.open(imgPath, function (err, image) {
    if (!err) {
        console.log(image.width);
        consoel.log(image.height);
    } else {
        console.log(err);
        console.log(imgPath);
    }
});

lwip_image is not the module you should be requiring. lwip_image不是您应该需要的模块。

You still need to require('lwip') . 您仍然需要require('lwip') You just need to put your build modules into the appropriate place so that lwip can use them when it needs to. 您只需要将构建模块放入适当的位置,以便lwip可以在需要时使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM