Azion Runtime and Node.js API compatibility

Node built-in

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🟢 Supportedprocess.env.VAR_NAMEOther features supported through polyfills (check table below)
url🟡 Partially supportedOnly global URL and URLSearchParams

FS support

Async:

  • fs.lstat(path[, options], callback)
  • fs.mkdir(path[, options], callback)
  • fs.stat(path[, options], callback)
  • fs.writeFile(file, data[, options], callback)
  • fs.readFile(path[, options], callback)
  • fs.readdir(path[, options], callback)
  • fs.writeFileSync(file, data[, options])
  • fs.rename(oldPath, newPath, callback)
  • fs.realpath(path[, options], callback)
  • fs.copyFile(src, dest[, mode], callback)
  • fs.cp(src, dest[, options], callback)
  • fs.read(fd, buffer, offset, length, position, callback)
  • fs.read(fd, buffer[, options], callback)
  • fs.read(fd[, options], callback)
  • fs.rmdir(path[, options], callback)
  • fs.utimes(path, atime, mtime, callback)

Node 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.

Here’s a list of Node APIs supported through polyfills:

APISupport LevelCode sample
buffer🟡 Partially supportedAccess code sample
crypto🟡 Partially supportedAccess code sample
events🟡 Partially supportedAccess code sample
fs🟡 Partially supportedAccess code sample
http🟡 Partially supportedAccess code sample
module🟡 Partially supportedAccess code sample
os🟡 Partially supportedAccess code sample
path🟡 Partially supportedAccess code sample
process🟡 Partially supportedAccess code sample
stream🟡 Partially supportedAccess code sample
string_decoder🟡 Partially supportedAccess code sample
timers🟡 Partially supportedAccess code sample
url🟡 Partially supportedAccess code sample
util🟡 Partially supportedAccess code sample
vm🟡 Partially supportedAccess code sample
zlib🟡 Partially supportedAccess code sample

For additional compatibility information:

Go to supported Web APIs Go to supported Web Frameworks

Contributors