JavaScript Modules

    The global variables , process, console, Buffer, filename and dirname are available throughout ArangoDB and Foxx.

    ArangoDB supports a number of modules for compatibility with Node.js, including:

    • assert implements basic assertion and testing functions.

    • implements a binary data type for JavaScript.

    • console is a well known logging facility to all the JavaScript developers.ArangoDB implements most of the ,with the exceptions of profile and count.

    • events implements an event emitter.

    • provides a file system API for the manipulation of paths,directories, files, links, and the construction of file streams.ArangoDB implements most Filesystem/A functions.

    • provides direct access to the module system.

    • path implements functions dealing with filenames and paths.

    • implements conversion functionsfor punycode encoding.

    • provides utilities for dealing with query strings.

    • stream provides a streaming interface.

    • provides utilities for URL resolution and parsing.

    Additionally ArangoDB provides partial implementations for the following modules:

    • net:only isIP, isIPv4 and isIPv6.

    • process:only env and cwd;stubs for , stdout.isTTY, stdout.write, nextTick.

    • timers:stubs for setImmediate, setTimeout, setInterval, clearImmediate, clearTimeout, clearInterval and ref.

    • tty:only isatty (always returns false).

    • vm:only .

    The following Node.js modules are not available at all:child_process,cluster,constants,crypto (but see @arangodb/crypto below),dgram,dns,domain,http (but see @arangodb/request below),https,os,sys,tls,v8,.

    There are a large number of ArangoDB-specific modules using the @arangodb namespace, mostly for internal use by ArangoDB itself. The following however are noteworthy:

    • @arangodb provides direct access to the database and its collections.

    • provides various cryptography functions including hashing algorithms.

    • @arangodb/request provides the functionality for making synchronous HTTP/HTTPS requests.

    • is the namespace providing the various building blocks of the Foxx microservice framework.

    The following NPM modules are preinstalled:

    • is the ArangoDB Query Builder and can be used to construct AQL queries with a chaining JavaScript API.

    • error-stack-parserparses stacktraces into a more useful format.

    • is an ArangoDB-compatible GraphQL server/schema implementation.

    • highlight.jsis an HTML syntax highlighter.

    • is a utility library for inflecting (e.g. pluralizing) words.

    • iconv-liteis a utility library for converting between character encodings

    • is a validation library that is supported throughout the Foxx framework.

    • js-yamlis a JavaScript implementation of the YAML data format (a partial superset of JSON).

    • is a utility belt for JavaScript providing various useful helper functions.

    • minimatchis a glob matcher for matching wildcards in file paths.

    • provides utilities for dealing with query strings using a different format than the querystring module.

    • semveris a utility library for handling semver version numbers.

    • is a mocking library for writing test stubs, mocks and spies.

    • timezoneis a library for converting date time values between formats and timezones.