Azion Runtime and Node.js API compatibility

Node.js APIs supported in Azion Runtime

The compatibility between Azion Runtime and Node.js is an ongoing task, but a set of Node Runtime APIs are listed and compatible with Azion Runtime. The following list of APIs can be imported inside edge functions with the standard import syntax:

import { API } from "import-origin";
APISupport LevelCode sampleComments
async_hooks๐ŸŸก Partially supportedAccess code sampleOnly AsyncLocalStorage and AsyncResource are implemented.
fs๐ŸŸก Partially supportedOnly async methods (check the list below), others through polyfills.
module๐ŸŸก Partially supportedAlso supported in local dev through polyfills (check table below).
process.env๐ŸŸข Supported Supportedprocess.env.VAR_NAMEOther features supported through polyfills (check table below).
url๐ŸŸก Partially supportedOnly global URL and URLSearchParams.

File System (FS) module support

The Azion Runtime provides native support for the File System (FS) module, allowing you to interact with the file system within your edge functions.

Async:

MethodParametersDescription
fs.lstatpath, options (optional), callbackGets information about the file or directory.
fs.mkdirpath, options (optional), callbackCreates a directory.
fs.statpath, options (optional), callbackGets information about the file or directory.
fs.writeFilefile, data, options (optional), callbackWrites data to a file.
fs.readFilepath, options (optional), callbackReads the contents of a file.
fs.readdirpath, options (optional), callbackReads the contents of a directory.
fs.writeFileSyncfile, data, options (optional)Writes data to a file synchronously.
fs.renameoldPath, newPath, callbackRenames a file or directory.
fs.realpathpath, options (optional), callbackResolves the absolute path of a file.
fs.copyFilesrc, dest, mode (optional), callbackCopies a file.
fs.cpsrc, dest, options (optional), callbackCopies files and directories.
fs.readfd, buffer, offset, length, position, callbackReads data from a file.
fs.readfd, buffer, options (optional), callbackReads data from a file.
fs.readfd, options (optional), callbackReads data from a file.
fs.rmdirpath, options (optional), callbackRemoves a directory.
fs.utimespath, atime, mtime, callbackUpdates the access and modification times of a file.

Supported Node APIs with polyfills

A polyfill is a code snippet, often used in JavaScript, that brings new features to environments lacking these capabilities. Polyfills are used during build time at Azion and can be configured through the azion.config.js file.

The following Node APIs are supported through polyfills, along with their respective supported methods.

ModuleStatus
_http_agent๐ŸŸก Partially supported
_http_client๐ŸŸก Partially supported
_http_common๐ŸŸก Partially supported
_http_incoming๐ŸŸก Partially supported
_http_outgoing๐ŸŸก Partially supported
_http_server๐ŸŸก Partially supported
_stream_duplex๐ŸŸก Partially supported
_stream_passthrough๐ŸŸก Partially supported
_stream_readable๐ŸŸก Partially supported
_stream_transform๐ŸŸก Partially supported
_stream_wrap๐ŸŸก Partially supported
_stream_writable๐ŸŸก Partially supported
_tls_common๐ŸŸก Partially supported
_tls_wrap๐ŸŸก Partially supported
assert๐ŸŸก Partially supported
assert/strict๐ŸŸก Partially supported
async_hooks๐ŸŸข Supported
buffer๐ŸŸก Partially supported
child_process๐ŸŸก Partially supported
cluster๐ŸŸข Supported
console๐ŸŸข Supported
constants๐ŸŸข Supported
crypto๐ŸŸก Partially supported
dgram๐ŸŸข Supported
diagnostics_channel๐ŸŸข Supported
dns๐ŸŸข Supported
dns/promises๐ŸŸข Supported
domain๐ŸŸข Supported
events๐ŸŸข Supported
fs๐ŸŸก Partially supported
fs/promises๐ŸŸก Partially supported
http๐ŸŸก Partially supported
http2๐ŸŸก Partially supported
https๐ŸŸก Partially supported
inspector๐ŸŸข Supported
inspector/promises๐ŸŸก Partially supported
module๐ŸŸก Partially supported
net๐ŸŸก Partially supported
os๐ŸŸข Supported
path๐ŸŸข Supported
path/posix๐ŸŸก Partially supported
path/win32๐ŸŸก Partially supported
perf_hooks๐ŸŸข Supported
process๐ŸŸก Partially supported
punycode๐ŸŸก Partially supported
querystring๐ŸŸก Partially supported
readline๐ŸŸข Supported
readline/promises๐ŸŸข Supported
repl๐ŸŸก Partially supported
stream๐ŸŸก Partially supported
stream/consumers๐ŸŸก Partially supported
stream/promises๐ŸŸก Partially supported
stream/web๐ŸŸข Supported
string_decoder๐ŸŸข Supported
sys๐ŸŸก Partially supported
timers๐ŸŸก Partially supported
timers/promises๐ŸŸข Supported
tls๐ŸŸก Partially supported
trace_events๐ŸŸข Supported
tty๐ŸŸข Supported
url๐ŸŸข Supported
util๐ŸŸก Partially supported
util/types๐ŸŸก Partially supported
v8๐ŸŸข Supported
vm๐ŸŸข Supported
wasi๐ŸŸข Supported
worker_threads๐ŸŸก Partially supported
zlib๐ŸŸข Supported

For additional compatibility information:

Go To Supported Web APIs Go To Supported Web Frameworks