Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/v0.48.x/javascript-api/k6-experimental/fs/seekmode.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/v0.48.x/javascript-api/k6-experimental/fs/seekmode/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
SeekMode
The SeekMode enum specifies the position from which to
seek in a file.
Members
| Member | Value | Description |
|---|---|---|
| Start | 0 | Seek from the start of the file. |
| Current | 1 | Seek from the current position in the file. |
| End | 2 | Seek from the end of the file. |
Example
import { open, SeekMode } from 'k6/experimental/fs';
let file;
(async function () {
file = await open('bonjour.txt');
})();
export default async function () {
// Seek 6 bytes from the start of the file
await file.seek(6, SeekMode.Start);
// Seek 2 more bytes from the current position
await file.seek(2, SeekMode.Current);
// Seek backwards 2 bytes from the end of the file
await file.seek(-2, SeekMode.End);
}Was this page helpful?
Related resources from Grafana Labs

