Skip to content
Cloudflare Docs

path

To enable built-in Node.js APIs and polyfills, add the nodejs_compat compatibility flag to your Wrangler configuration file. This also enables nodejs_compat_v2 as long as your compatibility date is 2024-09-23 or later. Learn more about the Node.js compatibility flag and v2.

The node:path โ†— module provides utilities for working with file and directory paths. The node:path module can be accessed using:

import path from "node:path";
path.join("/foo", "bar", "baz/asdf", "quux", "..");
// Returns: '/foo/bar/baz/asdf'

Refer to the Node.js documentation for path โ†— for more information.