Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/javascript-api/import.meta/resolve.md (append .md) or send Accept: text/markdown to /docs/k6/latest/javascript-api/import.meta/resolve/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
resolve( path )
Resolves a path to a URL string in the same way an import statement does.
Use this function to provide a path relative to the current module to functions like open that accept URLs. This is helpful because some k6 functions don’t resolve paths relative to the same origin, which can cause similar-looking paths to load different files from the filesystem.
| Parameter | Type | Description |
|---|---|---|
| path | string | The file path to resolve. |
Returns
| Type | Description |
|---|---|
| string | The resolved URL string. |
Example
import { open } from 'k6/experimental/fs';
const pdfFile = open(import.meta.resolve('./path/to/file.pdf'), 'b');
export default function () {
// Use the resolved file path
}Was this page helpful?
Related resources from Grafana Labs

