Skip to main content

path

还没翻译译自英文(developers.cloudflare.com)本页 6 段都还没译

Note

For compatibility dates of 2026-08-04 or later, Workers enables both nodejs_compat and nodejs_compat_v2 by default. These flags are not used for these compatibility dates. Existing projects do not need to remove them when updating their compatibility date. For earlier dates, add nodejs_compat to your Wrangler configuration file to opt in. For instructions to turn off Node.js compatibility, refer to the Node.js compatibility flag.

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.