<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>import.meta on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/import.meta/</link><description>Recent content in import.meta on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/javascript-api/import.meta/index.xml" rel="self" type="application/rss+xml"/><item><title>resolve( path )</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/import.meta/resolve/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/import.meta/resolve/</guid><content><![CDATA[&lt;h1 id=&#34;resolve-path-&#34;&gt;resolve( path )&lt;/h1&gt;
&lt;p&gt;Resolves a path to a URL string in the same way an import statement does.&lt;/p&gt;
&lt;p&gt;Use this function to provide a path relative to the current module to functions like &lt;code&gt;open&lt;/code&gt; that accept URLs. This is helpful because some k6 functions don&amp;rsquo;t resolve paths relative to the same origin, which can cause similar-looking paths to load different files from the filesystem.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Parameter&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;path&lt;/td&gt;
              &lt;td&gt;string&lt;/td&gt;
              &lt;td&gt;The file path to resolve.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;returns&#34;&gt;Returns&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;string&lt;/td&gt;
              &lt;td&gt;The resolved URL string.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;!-- md-k6:skip --&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import { open } from &amp;#39;k6/experimental/fs&amp;#39;;

const pdfFile = open(import.meta.resolve(&amp;#39;./path/to/file.pdf&amp;#39;), &amp;#39;b&amp;#39;);

export default function () {
  // Use the resolved file path
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="resolve-path-">resolve( path )&lt;/h1>
&lt;p>Resolves a path to a URL string in the same way an import statement does.&lt;/p>
&lt;p>Use this function to provide a path relative to the current module to functions like &lt;code>open&lt;/code> that accept URLs. This is helpful because some k6 functions don&amp;rsquo;t resolve paths relative to the same origin, which can cause similar-looking paths to load different files from the filesystem.&lt;/p></description></item></channel></rss>