JavaScript modules | Native add-ons then | Native add-ons now | ||
---|---|---|---|---|
1. | ... need to be compiled. | No | Not if there are pre-builds | Not if there are pre-builds |
2. | ... will work on all platforms and architectures. | Yes | Yes if there are pre-builds | Yes if there are pre-builds |
3. | ... are designed to work with all current and subsequent Node.js versions once written. | Yes | No | Yes if using N-API |
4. | ... can be loaded multiple times. | Yes | No | Yes if written as a context-aware add-on |
5. | ... are thread-safe if not explicitly making use of threading infrastructure. | Yes | No | Yes if written as a context-aware add-on |
6. | ... can be unloaded. | Yes | No | Yes if written as a context-aware add-on and using [cleanup hooks](https://nodejs. |
JavaScript modules | Native add-ons | ||
---|---|---|---|
1. | ... need to be compiled. | No | Not if there are pre-builds |
2. | ... will work on all platforms and architectures. | Yes | Yes if there are pre-builds |
3. | ... are designed to work with all current and subsequent Node.js versions once written. | Yes | No |
4. | ... can be loaded multiple times. | Yes | No |
5. | ... are thread-safe if not explicitly making use of threading infrastructure. | Yes | No |
6. | ... can be unloaded. | Yes | No |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <node.h> | |
#include "common.h" | |
namespace { | |
void Init(v8::Local<v8::Object> exports, | |
v8::Local<v8::Object> module, | |
v8::Local<v8::Context> context) { | |
v8::Local<v8::Name> propName = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <napi.h> | |
#include <stdio.h> | |
namespace { | |
// Per-instance addon data. An instance of this class is passed to every binding | |
// and makes it possible to avoid setting global static variables. | |
class AddonData { | |
public: | |
AddonData(std::string config_file): config_file(config_file) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <node.h> | |
#include "common.h" | |
namespace { | |
void Init(v8::Local<v8::Object> exports, | |
v8::Local<v8::Object> module, | |
v8::Local<v8::Context> context) { | |
v8::Local<v8::Name> propName = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Process 15817 stopped | |
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.4 | |
frame #0: 0x0000000105b66385 binding_noexcept.node`Napi::AsyncWorker::AsyncWorker(this=0x0000000105915dd0, receiver=0x00007ffeefbfca10, callback=0x00007ffeefbfcad0, resource_name="TestResource", resource=0x00007ffeefbfca78) at napi-inl.h:3537 | |
3534 auto runner = AsyncWorker::OnExecute; | |
3535 auto completer = AsyncWorker::OnWorkComplete; | |
3536 | |
-> 3537 status = napi_create_async_work(_env, resource, resource_id, runner, | |
3538 completer, this, &_work); | |
3539 NAPI_THROW_IF_FAILED_VOID(_env, status); | |
3540 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenSSH_7.5p1, OpenSSL 1.1.0h-fips 27 Mar 2018 | |
debug1: Reading configuration data /home/nix/.ssh/config | |
debug1: Reading configuration data /etc/ssh/ssh_config | |
debug3: /etc/ssh/ssh_config line 56: Including file /etc/ssh/ssh_config.d/05-redhat.conf depth 0 | |
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf | |
debug3: /etc/ssh/ssh_config.d/05-redhat.conf line 2: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 | |
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config | |
debug3: gss kex names ok: [gss-gex-sha1-,gss-group14-sha1-] | |
debug3: kex names ok: [curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1] | |
debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
class Signature; | |
class FunctionTemplate; | |
template <class V8Type> | |
class Local { | |
public: | |
// Local(const char* x, Local<FunctionTemplate> y): | |
// val_(nullptr), realval_(x, y) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stdio.h> | |
#include <node_api.h> | |
static napi_value AcceptTypedArray(napi_env env, napi_callback_info info) { | |
napi_value typed_array = nullptr; | |
size_t argc = 1; | |
assert(napi_get_cb_info(env, | |
info, | |
&argc, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
password: vubuntu | |
chpasswd: { expire: False } | |
ssh_pwauth: True | |
network: | |
version: 2 | |
ethernets: | |
enp0s3: | |
dhcp4: true | |
gateway4: 192.168.56.1 |