JavaScript Modules
ArangoDB uses a Node.js compatible module system. You can use the functionrequire()
in order to load a module or library. It returns the exportedvariables and functions of the module.
The following global variables are available throughout ArangoDB and Foxx:
global
process
console
Buffer
__filename
__dirname
Node compatibility modules
ArangoDB supports a number of modules for compatibility with Node.js, including:
assertimplements basic assertion and testing functions.
bufferimplements a binary data type for JavaScript.
consoleis a well known logging facility to all the JavaScript developers.ArangoDB implements most of the Console API,with the exceptions of profile and count.
eventsimplements an event emitter.
fsprovides a file system API for the manipulation of paths, directories, files,links, and the construction of file streams. ArangoDB implements mostFilesystem/Afunctions.
moduleprovides direct access to the module system.
pathimplements functions dealing with filenames and paths.
punycodeimplements conversion functions forpunycode encoding.
querystringprovides utilities for dealing with query strings.
streamprovides a streaming interface.
string_decoderimplements logic for decoding buffers into strings.
urlprovides utilities for URL resolution and parsing.
utilprovides general utility functions like
format
andinspect
.
Additionally ArangoDB provides partial implementations for the following modules:
net
:onlyisIP
,isIPv4
andisIPv6
.process
:onlyenv
andcwd
;stubs forargv
,stdout.isTTY
,stdout.write
,nextTick
.timers
:stubs forsetImmediate
,setTimeout
,setInterval
,clearImmediate
,clearTimeout
,clearInterval
andref
.tty
:onlyisatty
(always returnsfalse
).vm
:onlyrunInThisContext
.
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
zlib
ArangoDB Specific Modules
There are a large number of ArangoDB-specific modules using the @arangodb
namespace, mostly for internal use by ArangoDB itself. The following modulesnoteworthy however and intended to be used by the user:
@arangodbprovides direct access to the database and its collections.
@arangodb/analyzersprovides an interface to manage ArangoSearch Analyzers.
AQL related modules:
@arangodb/aql/queriesoffers methods to track and kill AQL queries.
@arangodb/aql/cacheallows to control the AQL query caching feature.
@arangodb/aql/explainerprovides methods to debug, explain and profile AQL queries.
@arangodb/aql/functionsprovides an interface to (un-)register user-defined AQL functions.
@arangodb/cryptoprovides various cryptography functions including hashing algorithms.
@arangodb/foxxis the namespace providing the various building blocks of the Foxxmicroservice framework.
- @arangodb/localsis a helper module to use Foxx together with Webpack.
Graph related modules:
@arangodb/general-graphimplements a graph management interface for named graphs.
@arangodb/smart-graphprovides management features for SmartGraphs
@arangodb/graph-examples/example-graph.jscan load example graphs (creates collections, populates them with documentsand creates named graphs)
@arangodb/replicationis used for setting up and synchronizing data for Master/Slave replication.
@arangodb/requestprovides the functionality for making synchronous HTTP/HTTPS requests.
@arangodb/tasksimplements task management methods
@arangodb/usersprovides an interface for user management.
Bundled NPM Modules
The following NPM modulesare preinstalled:
aqbis 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.
dedentis a simple utility function for formatting multi-line strings.
error-stack-parserparses stacktraces into a more useful format.
graphql-syncis an ArangoDB-compatible GraphQL server/schema implementation.
highlight.jsis an HTML syntax highlighter.
i (inflect)is a utility library for inflecting (e.g. pluralizing) words.
iconv-liteis a utility library for converting between character encodings
joiis 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).
lodashis a utility belt for JavaScript providing various useful helper functions.
minimatchis a glob matcher for matching wildcards in file paths.
qsprovides utilities for dealing with query strings using a different formatthan the querystring module.
semveris a utility library for handling semver version numbers.
sinonis a mocking library for writing test stubs, mocks and spies.
timezoneis a library for converting date time values between formats and timezones.