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 supported Partially supportedAccess code sampleOnly AsyncLocalStorage and AsyncResource are implemented.
fs🟡 Partially supported Partially supportedOnly async methods (check the list below), others through polyfills.
module🟡 Partially supported 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 supported 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

Contributors