Skip to main content
ReadStream - fs - Node documentation
class ReadStream
extends stream.Readable

Usage in Deno

import { ReadStream } from "node:fs";

Instances of fs.ReadStream are created and returned using the createReadStream function.

Properties

bytesRead: number

The number of bytes that have been read so far.

path: string | Buffer

The path to the file the stream is reading from as specified in the first argument to fs.createReadStream(). If path is passed as a string, thenreadStream.path will be a string. If path is passed as a Buffer, thenreadStream.path will be a Buffer. If fd is specified, thenreadStream.path will be undefined.

pending: boolean

This property is true if the underlying file has not been opened yet, i.e. before the 'ready' event is emitted.

Methods

addListener(
event: "close",
listener: () => void,
): this

events.EventEmitter

  1. open
  2. close
  3. ready
addListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
addListener(
event: "end",
listener: () => void,
): this
addListener(
event: "error",
listener: (err: Error) => void,
): this
addListener(
event: "open",
listener: (fd: number) => void,
): this
addListener(
event: "pause",
listener: () => void,
): this
addListener(
event: "readable",
listener: () => void,
): this
addListener(
event: "ready",
listener: () => void,
): this
addListener(
event: "resume",
listener: () => void,
): this
addListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
close(callback?: (err?: ErrnoException | null) => void): void
on(
event: "close",
listener: () => void,
): this
on(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
on(
event: "end",
listener: () => void,
): this
on(
event: "error",
listener: (err: Error) => void,
): this
on(
event: "open",
listener: (fd: number) => void,
): this
on(
event: "pause",
listener: () => void,
): this
on(
event: "readable",
listener: () => void,
): this
on(
event: "ready",
listener: () => void,
): this
on(
event: "resume",
listener: () => void,
): this
on(
event: string | symbol,
listener: (...args: any[]) => void,
): this
once(
event: "close",
listener: () => void,
): this
once(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
once(
event: "end",
listener: () => void,
): this
once(
event: "error",
listener: (err: Error) => void,
): this
once(
event: "open",
listener: (fd: number) => void,
): this
once(
event: "pause",
listener: () => void,
): this
once(
event: "readable",
listener: () => void,
): this
once(
event: "ready",
listener: () => void,
): this
once(
event: "resume",
listener: () => void,
): this
once(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependListener(
event: "close",
listener: () => void,
): this
prependListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
prependListener(
event: "end",
listener: () => void,
): this
prependListener(
event: "error",
listener: (err: Error) => void,
): this
prependListener(
event: "open",
listener: (fd: number) => void,
): this
prependListener(
event: "pause",
listener: () => void,
): this
prependListener(
event: "readable",
listener: () => void,
): this
prependListener(
event: "ready",
listener: () => void,
): this
prependListener(
event: "resume",
listener: () => void,
): this
prependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
prependOnceListener(
event: "close",
listener: () => void,
): this
prependOnceListener(
event: "data",
listener: (chunk: Buffer | string) => void,
): this
prependOnceListener(
event: "end",
listener: () => void,
): this
prependOnceListener(
event: "error",
listener: (err: Error) => void,
): this
prependOnceListener(
event: "open",
listener: (fd: number) => void,
): this
prependOnceListener(
event: "pause",
listener: () => void,
): this
prependOnceListener(
event: "readable",
listener: () => void,
): this
prependOnceListener(
event: "ready",
listener: () => void,
): this
prependOnceListener(
event: "resume",
listener: () => void,
): this
prependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
Back to top