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

x/pbkit/misc/file.ts

Protobuf toolkit for modern web development
Go to Latest
File
export async function getAutoClosingFileReader( path: Parameters<typeof Deno.open>[0],): Promise<Deno.Reader> { const file = await Deno.open(path, { read: true }); return { async read(p) { const bytes = await file.read(p); if (bytes == null) file.close(); return bytes; }, };}