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

x/mock_file/src/memory_file.ts>InMemoryFsFile

Synchronous file system API polyfill for deno deploy.
Go to Latest
class InMemoryFsFile
implements [Deno.FsFile]
import { InMemoryFsFile } from "https://deno.land/x/mock_file@v1.0.1/src/memory_file.ts";

A mock of Deno.FsFile. This has a one-to-one correspondence with rid.

Constructors

new
InMemoryFsFile(virtualFile: { buffer: Uint8Array; info: Deno.FileInfo; })

Properties

readonly
readable: ReadableStream<Uint8Array>
readonly
rid: number
readonly
writable: WritableStream<Uint8Array>

Methods

read(p: Uint8Array): Promise<number | null>
readSync(p: Uint8Array): number | null
seek(offset: number, whence: Deno.SeekMode): Promise<number>
seekSync(offset: number, whence: Deno.SeekMode): number
stat(): Promise<Deno.FileInfo>
truncate(len?: number | undefined): Promise<void>
truncateSync(len?: number | undefined): void
write(p: Uint8Array): Promise<number>
writeSync(p: Uint8Array): number

Static Properties

readonly
ridToFile: Readonly<Record<number, InMemoryFsFile | undefined>>