Node.js API compatibility - Path

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.

/**
* An example of using the Node.js Path API in an Azion Edge Function.
* Support:
* - Partially supported (Extended by library `path-browserify`)
* @module runtime-apis/nodejs/path/main
* @example
* // Execute with Azion Bundler:
* npx edge-functions build
* npx edge-functions dev
*/
import path from "node:path";
/**
* An example of using the Node.js Path API in an Azion Edge Function.
* @param {*} event
* @returns {Promise<Response>}
*/
const main = async (event) => {
const pathName = path.join("/", "images", "image.jpg");
console.log("Path", pathName);
return new Response(`Path: ${pathName}`);
};
export default main;

Contributors