forked from denoland/std
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/expect-object-containing' of github.com:eryue0220/…
…deno_std into feat/expect-object-containing * 'feat/expect-object-containing' of github.com:eryue0220/deno_std: BREAKING(io): remove `StringReader` (denoland#6062) BREAKING(io): remove `StringWriter` (denoland#6061) BREAKING(io): remove `MultiReader` (denoland#6059) BREAKING(io): remove `LimitedReader` (denoland#6058) chore: fix heading level in Releases.md (denoland#6044) BREAKING(io): remove `readDelim()` (denoland#6052) BREAKING(io): remove `BufWriter` (denoland#6057) BREAKING(io): remove `BufReader` (denoland#6056)
- Loading branch information
Showing
20 changed files
with
42 additions
and
2,429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
|
||
import type { Reader } from "@std/io/types"; | ||
|
||
export class MultiReader implements Reader { | ||
readonly #readers: Reader[]; | ||
#currentIndex = 0; | ||
|
||
constructor(readers: Reader[]) { | ||
this.#readers = [...readers]; | ||
} | ||
|
||
async read(p: Uint8Array): Promise<number | null> { | ||
const r = this.#readers[this.#currentIndex]; | ||
if (!r) return null; | ||
const result = await r.read(p); | ||
if (result === null) { | ||
this.#currentIndex++; | ||
return 0; | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.