Node.js API compatibility - Path
This documentation explores the integration and usage of the Node.js Path module within the Azion Runtime. The Path module provides utilities for working with file and directory paths.
The path module in Node.js provides utilities for working with file and directory paths. It offers a set of functions that help developers manipulate and normalize paths, making it easier to handle file system operations across different operating systems. This module is available in the Azion Runtime through Node.js compatibility, and it’s commonly used in functions to build or normalize paths, for example when routing requests or composing asset references.
Example: Basic path operations
The example below shows how to use the path module in a function:
Example: URL routing with path
Use path methods to parse and construct URL paths for routing:
Example: Path normalization and parsing
Normalize paths and extract detailed path information:
Example: Path joining for static assets
Build paths for static assets and content delivery:
Example: Cross-platform path handling
Handle paths consistently across different environments:
Supported APIs
| API | Status |
|---|---|
path.basename() | 🟢 Supported |
path.dirname() | 🟢 Supported |
path.extname() | 🟢 Supported |
path.format() | 🟢 Supported |
path.isAbsolute() | 🟢 Supported |
path.join() | 🟢 Supported |
path.normalize() | 🟢 Supported |
path.parse() | 🟢 Supported |
path.relative() | 🟢 Supported |
path.resolve() | 🟢 Supported |
path.sep | 🟢 Supported |
path.delimiter | 🟢 Supported |
path.posix | 🟢 Supported |
path.win32 | 🟢 Supported |