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:
API | Support Level | Code sample | Comments |
---|---|---|---|
async_hooks | 🟡 Partially supported | Access code sample | Only AsyncLocalStorage and AsyncResource are implemented |
process.env | 🟢 Supported | process.env.VAR_NAME | |
fs | 🟡 Partially supported | Check the list below |
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:
API | Support Level | Code sample |
---|---|---|
buffer | 🟡 Partially supported | Access code sample |
fs | 🟡 Partially supported | Access code sample |
crypto | 🟡 Partially supported | - |
dns | 🟡 Partially supported | - |
http2 | 🟡 Partially supported | - |
module | 🟡 Partially supported | - |
navigator | 🟡 Partially supported | - |
path_dirname | 🟡 Partially supported | - |
performance | 🟡 Partially supported | - |
process | 🟡 Partially supported | - |
accepts | 🟡 Partially supported | - |
child_process | 🟡 Partially supported | - |
cluster | 🟡 Partially supported | - |
console | 🟡 Partially supported | - |
dgram | 🟡 Partially supported | - |
events | 🟡 Partially supported | - |
http | 🟡 Partially supported | - |
https | 🟡 Partially supported | - |
inspector | 🟡 Partially supported | - |
net | 🟡 Partially supported | - |
os | 🟡 Partially supported | - |
path | 🟡 Partially supported | - |
perf_hooks | 🟡 Partially supported | - |
querystring | 🟡 Partially supported | - |
readline | 🟡 Partially supported | - |
repl | 🟡 Partially supported | - |
stream | 🟡 Partially supported | - |
_stream_passthrough | 🟡 Partially supported | - |
_stream_readable | 🟡 Partially supported | - |
_stream_transform | 🟡 Partially supported | - |
_stream_writable | 🟡 Partially supported | - |
string_decoder | 🟡 Partially supported | - |
sys | 🟡 Partially supported | - |
timers | 🟡 Partially supported | - |
tls | 🟡 Partially supported | - |
tty | 🟡 Partially supported | - |
url | 🟡 Partially supported | - |
util | 🟡 Partially supported | - |
vm | 🟡 Partially supported | - |
zlib | 🟡 Partially supported | - |
For additional compatibility information:
Go to supported Web APIs Go to supported Web Frameworks