Modules

import.meta.url

The absolute URL of the current ES module. For an ordinary local ES module it is a file URL, not a native filesystem path. Use Node URL conversion APIs when a native path is required.

Formal Syntax & Structure

nodejs syntaxnodejs
import.meta.url

Return Value

string

Module URL property value.

Working Example

Example Snippetnodejs
console.log(new URL(import.meta.url).protocol);
Node.js Reference