import.meta.url


    这与提供当前模块文件 URL 的浏览器中的定义完全相同。

    • <string> The absolute file: URL of the module.

    This is defined exactly the same as it is in browsers providing the URL of the current module file.

    This enables useful patterns such as relative file loading:

    import { readFileSync } from 'node:fs';
    const buffer = readFileSync(new URL('./data.proto', import.meta.url));