Skip to main content
The Deno 2 Release Candidate is here
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function readStringDelim
Deprecated
Deprecated

(will be removed after 1.0.0) Use the [Web Streams API]https://developer.mozilla.org/en-US/docs/Web/API/Streams_API instead.

import { readStringDelim } from "https://deno.land/std@0.212.0/io/read_string_delim.ts";

Read Reader chunk by chunk, splitting based on delimiter.

Examples

Example 1

import { readStringDelim } from "https://deno.land/std@0.212.0/io/read_string_delim.ts";
import * as path from "https://deno.land/std@0.212.0/path/mod.ts";

const filename = path.join(Deno.cwd(), "std/io/README.md");
let fileReader = await Deno.open(filename);

for await (let line of readStringDelim(fileReader, "\n")) {
  console.log(line);
}

Parameters

reader: Reader
delim: string
optional
decoderOpts: { encoding?: string; fatal?: boolean; ignoreBOM?: boolean; }

Returns

AsyncIterableIterator<string>