rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../../../pm/cli/install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

The Bun.main property contains the absolute path to the current entrypoint.

console.log(Bun.main);

The printed path corresponds to the file that is executed with bun run.

terminal

bun run index.ts
/path/to/index.ts

terminal

bun run foo.ts
/path/to/foo.ts

See Docs > API > Utils for more useful utilities.

Was this page helpful?

Suggest editsRaise issue

[

Check if the current file is the entrypoint

Previous

](../entrypoint/index.md)[

Build an app with Astro and Bun

Next

](../../ecosystem/astro/index.md)