nan alternatives and similar modules
Based on the "Miscellaneous" category.
Alternatively, view nan alternatives based on common mentions on social networks and blogs.
cheerio9.5 9.3 L4 nan VS cheerioThe fast, flexible, and elegant library for parsing and manipulating HTML and XML.
husky9.5 8.1 nan VS huskyGit hooks made easy 🐶 woof!
dotenv9.1 8.1 L5 nan VS dotenvLoads environment variables from .env for nodejs projects.
v869.1 8.7 L1 nan VS v86x86 virtualization in your browser, recompiling x86 to wasm on the fly
agenda8.3 8.8 L4 nan VS agendaLightweight job scheduling for Node.js
patch-package8.1 8.6 nan VS patch-packageFix broken node modules instantly 🏃🏽♀️💨
nodegit7.8 8.6 L4 nan VS nodegitNative Node bindings to Git.
execa7.5 8.9 L4 nan VS execaProcess execution for humans
opencv7.5 0.0 L1 nan VS opencvOpenCV Bindings for node.js
semver7.4 8.4 L2 nan VS semverThe semver parser for node (the one npm uses)
editly7.0 8.5 nan VS editlySlick, declarative command line video editing & API
Faker.js6.6 1.7 nan VS Faker.jsWhat really happened with Aaron Swartz?
file-type6.6 8.2 L2 nan VS file-typeDetect the file type of a Buffer/Uint8Array/ArrayBuffer
simplecrawler6.6 1.3 L5 nan VS simplecrawlerFlexible event driven crawler for node.
opn6.4 4.5 nan VS opnOpen stuff like URLs, files, executables. Cross-platform.
webworker-threads6.2 1.5 L1 nan VS webworker-threadsLightweight Web Worker API implementation with native threads
clipboardy5.7 0.0 nan VS clipboardyAccess the system clipboard (copy/paste)
banshee5.7 0.0 nan VS bansheeReal-time anomalies detection for periodic time series.
node-pre-gyp5.7 6.4 L5 nan VS node-pre-gypNode.js tool for easy binary deployment of C++ addons
emittery5.6 6.6 nan VS emitterySimple and modern async event emitter
@sindresorhus/is5.6 6.0 nan VS @sindresorhus/isType check values
Bottleneck5.4 0.0 L4 nan VS BottleneckJob scheduler and rate limiter, supports Clustering
mem5.0 0.0 L5 nan VS memMemoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input
hasha4.8 2.5 nan VS hashaHashing made simple. Get the hash of a buffer/string/stream/file.
dot-prop4.6 3.3 L5 nan VS dot-propGet, set, or delete a property from a nested object using a dot path
node-bell4.5 0.0 L5 nan VS node-bellReal-time anomalies detection for periodic time series.
basic-ftp4.4 9.0 nan VS basic-ftpFTP client for Node.js, supports FTPS over TLS, passive mode over IPv6, async/await, and Typescript.
schemapack3.9 0.0 L3 nan VS schemapackCreate a schema object to encode/decode your JSON in to a compact byte buffer with no overhead.
nar3.7 0.0 nan VS narnode.js application archive - create self-contained binary like executable applications that are ready to ship and run
cashify3.4 0.0 nan VS cashify💸 Lightweight currency conversion library, successor of money.js
stringify-object3.4 0.0 L3 nan VS stringify-objectStringify an object/array like JSON.stringify just without all the double-quotes
common-errors3.4 0.0 L5 nan VS common-errorsCommon error classes and utility functions
deep-assign3.4 0.0 L5 nan VS deep-assignRecursive Object.assign().
node-video-lib3.2 0.0 nan VS node-video-libNode.js Video Library / MP4 & FLV parser / MP4 builder / HLS muxer
import-fresh3.0 0.0 nan VS import-freshImport a module while bypassing the cache
require-uncached3.0 0.0 nan VS require-uncachedImport a module while bypassing the cache
os-locale2.9 0.0 L5 nan VS os-localeGet the system locale
lazy-req2.8 0.0 nan VS lazy-reqImport a module lazily
import-lazy2.8 0.0 nan VS import-lazyImport a module lazily
onetime2.3 0.0 nan VS onetimeEnsure a function is only called once
resolve-from2.2 0.0 nan VS resolve-fromResolve the path of a module like require.resolve() but from a given path
strip-bom2.1 0.0 nan VS strip-bomStrip UTF-8 byte order mark (BOM) from a string
parent-module1.5 1.5 nan VS parent-moduleGet the path of the parent module
remote-git-tags1.4 2.5 nan VS remote-git-tagsGet tags from a remote git repo. Using only JS. No git binary required.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of nan or a related project?
Native Abstractions for Node.js
A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 and 18.
Current version: 2.16.0
(See CHANGELOG.md for complete ChangeLog)
Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect
NODE_MODULE_VERSION and get yourself into a macro-tangle.
This project also contains some helper utilities that make addon development a bit more pleasant.
News & Updates
Simply add NAN as a dependency in the package.json of your Node addon:
$ npm install --save nan
Pull in the path to NAN in your binding.gyp so that you can use
#include <nan.h> in your .cpp files:
"include_dirs" : [ "<!(node -e \"require('nan')\")" ]
This works like a
-I<path-to-NAN> when compiling your addon.
Just getting started with Nan? Take a look at the Node Add-on Examples.
Refer to a quick-start Nan Boilerplate for a ready-to-go project that utilizes basic Nan functionality.
For a simpler example, see the async pi estimation example in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of NAN.
Yet another example is nan-example-eol. It shows newline detection implemented as a native addon.
Also take a look at our comprehensive C++ test suite which has a plethora of code snippets for your pasting pleasure.
Additional to the NAN documentation below, please consult:
<!-- START API -->
- Method argument types
- Method declarations
- Method declaration
- Getter declaration
- Setter declaration
- Property getter declaration
- Property setter declaration
- Property enumerator declaration
- Property deleter declaration
- Property query declaration
- Index getter declaration
- Index setter declaration
- Index enumerator declaration
- Index deleter declaration
- Index query declaration
- Method and template helpers
A local handle is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works.
A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope.
The creation of
HandleScope objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these.
Also see the V8 Embedders Guide section on Handles and Garbage Collection.
An object reference that is independent of any
HandleScope is a persistent reference. Where a
Local handle only lives as long as the
HandleScope in which it was allocated, a
Persistent handle remains valid until it is explicitly disposed.
Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the
Persistent classes to supply compatibility across the V8 versions supported.
- Nan::PersistentBase & v8::PersistentBase
- Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits
- Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits
Also see the V8 Embedders Guide section on Handles and Garbage Collection.
NAN provides a
NAN contains functions that convert
v8::Values to other
v8::Value types and native types. Since type conversion is not guaranteed to succeed, they return
Nan::Maybe types. These converters can be used in place of
X is one of the types, e.g.
Boolean) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new
v8::MaybeLocal types for these conversions, older versions don't have this functionality so it is provided by NAN.
Nan::Maybe types are monads that encapsulate
v8::Local handles that may be empty.
- Maybe Types
- Maybe Helpers
v8::Script helpers as the API has changed over the supported versions of V8.
The JSON object provides the C++ versions of the methods offered by the
Refer to the V8 JSON object in the V8 documentation for more information about these methods and their arguments.
NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted.
Note that an Error object is simply a specialized form of
Also consult the V8 Embedders Guide section on Exceptions for more information.
node::Buffer helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility.
Nan::Callback makes it easier to use
v8::Function handles as callbacks. A class that wraps a
v8::Function handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution.
Asynchronous work helpers
Nan::AsyncProgressQueueWorker are helper classes that make working with asynchronous code easier.
- Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker
Strings & Bytes
Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing.
ObjectWrap class can be used to make wrapped C++ objects and a factory of wrapped objects.
The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods.
Miscellaneous V8 Helpers
Miscellaneous Node Helpers
<!-- END API -->
To run the NAN tests do:
npm install npm run-script rebuild-tests npm test
npm install make test
Compiling against Node.js 0.12 on OSX
With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12 do not compile anymore. The error looks something like:
❯ CXX(target) Release/obj.target/accessors/cpp/accessors.o In file included from ../cpp/accessors.cpp:9: In file included from ../../nan.h:51: In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61: /Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope' return Handle<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( ~~~~~~~~~~~~~^~~~~~~~~~~~
This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make
v8::Handle a friend of
v8::HandleScope. Since neither Node.js not V8 support this release line anymore
this patch cannot be released by either project in an official release.
For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support that configuration, you will need to either get an older compiler, or apply a source patch to the version of V8 headers as a workaround.
Governance & Contributing
NAN is governed by the Node.js Addon API Working Group
Addon API Working Group (WG)
The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project.
Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects.
The WG has final authority over this project including:
- Technical direction
- Project governance and process (including this policy)
- Contribution policy
- GitHub repository hosting
- Maintaining the list of additional Collaborators
For the current list of WG members, see the project [README.md](./README.md#collaborators).
Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote.
Note: If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly.
For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators).
Consensus Seeking Process
The WG follows a Consensus Seeking decision making model.
Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification.
If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
WG Members / Collaborators
Rod VaggGitHub/rvaggTwitter/@rvagg Benjamin ByholmGitHub/kkoopa- Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate Brett LawsonGitHub/brett19Twitter/@brett19x Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis David SiegelGitHub/agnatTwitter/@agnat Michael Ira KrufkyGitHub/mkrufkyTwitter/@mkrufky
Licence & copyright
Copyright (c) 2018 NAN WG Members / Collaborators (listed above).
Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
*Note that all licence references and agreements mentioned in the nan README section above are relevant to that project's source code only.