Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/dts/lib.deno.ns.d.ts>Deno.Seeker

A modern runtime for JavaScript and TypeScript.
Go to Latest
interface Deno.Seeker
import { type Deno } from "https://deno.land/x/deno@v1.28.0/cli/dts/lib.deno.ns.d.ts";
const { Seeker } = Deno;

An abstract interface which when implemented provides an interface to seek within an open file/resource asynchronously.

Methods

seek(offset: number, whence: SeekMode): Promise<number>

Seek sets the offset for the next read() or write() to offset, interpreted according to whence: Start means relative to the start of the file, Current means relative to the current offset, and End means relative to the end. Seek resolves to the new offset relative to the start of the file.

Seeking to an offset before the start of the file is an error. Seeking to any positive offset is legal, but the behavior of subsequent I/O operations on the underlying object is implementation-dependent.

It resolves with the updated offset.