JavaScript Modules

    The following global variables are available throughout ArangoDB and Foxx:

    • global
    • process
    • console
    • Buffer
    • __filename
    • __dirname

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

    • implements basic assertion and testing functions.

    • bufferimplements a binary data type for JavaScript.

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

    • implements an event emitter.

    • fsprovides a file system API for the manipulation of paths, directories, files,links, and the construction of file streams. ArangoDB implements mostfunctions.

    • moduleprovides direct access to the module system.

    • implements functions dealing with filenames and paths.

    • punycodeimplements conversion functions for encoding.

    • querystringprovides utilities for dealing with query strings.

    • provides a streaming interface.

    • string_decoderimplements logic for decoding buffers into strings.

    • provides utilities for URL resolution and parsing.

    • utilprovides general utility functions like format and inspect.

    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.

    • 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 @arangodbnamespace, mostly for internal use by ArangoDB itself. The following modulesnoteworthy however and intended to be used by the user:

    • provides direct access to the database and its collections.

    • @arangodb/analyzersprovides an interface to manage ArangoSearch Analyzers.

    • AQL related modules:

      • offers methods to track and kill AQL queries.

      • @arangodb/aql/cacheallows to control the AQL query caching feature.

      • provides methods to debug, explain and profile AQL queries.

      • @arangodb/aql/functionsprovides an interface to (un-)register user-defined AQL functions.

    • provides various cryptography functions including hashing algorithms.

    • Graph related modules:

    • is used for setting up and synchronizing data for Master/Slave replication.

    • @arangodb/tasksimplements task management methods

    • provides an interface for user management.

    The following NPM modulesare preinstalled:

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

    • chaiis a full-featured assertion library for writing JavaScript tests.

    • is a simple utility function for formatting multi-line strings.

    • 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 formatthan the querystring module.

    • semveris a utility library for handling semver version numbers.

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