Compatibilidade APIs Node.js - Path

O módulo path no Node.js fornece utilitários para trabalhar com caminhos de arquivos e diretórios. Ele oferece um conjunto de funções que ajudam os desenvolvedores a manipular e normalizar caminhos, facilitando a execução de operações no sistema de arquivos em diferentes sistemas operacionais.

/**
* 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;

Contribuidores