SkillAgentSearch skills...

Napi101

Let's learn N-API (Native API of NodeJS 8.7.0)

Install / Use

/learn @1995parham/Napi101
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Napi101

Introduction

The N-API is a new and better way for creating native module for NodeJS. In this repository I tried to create some simple and functional example of N-API. N-API is in early stage so it may have inconsistent documentation so I create example based on thing that I can do correctly.

Issues

  1. N-API Callback Return

Examples

Hello

This module register hello function on hello module. hello function prints Hello world on console with printf and return 1373 from native function into javascript caller.

hello.js
src
 |
 \ hello.c

Bye

This module register byeSync and byeASync functions on bye module. ByeSync function waits 1s and do some work and ByeASync waits 1s asynchronously and do some work. Both functions return 1373 at the end into javascript caller.

bye.js
src
 |
 \ bye.c

Installation

npm install
# have fun with your native module.
node --napi-modules index.js
View on GitHub
GitHub Stars12
CategoryEducation
Updated1y ago
Forks0

Languages

C

Security Score

80/100

Audited on Jan 6, 2025

No findings