Skip to content

Latest commit

 

History

History
180 lines (113 loc) · 4.84 KB

File metadata and controls

180 lines (113 loc) · 4.84 KB

@wholebuzz/fs / Exports / lines

Module: lines

Table of contents

Functions

Functions

appendLine

appendLine(fileSystem: FileSystem, urlText: string, line: string): Promise<FileStatus | null>

Appends a line of text to a file.

Parameters

Name Type
fileSystem FileSystem
urlText string
line string

Returns: Promise<FileStatus | null>

Defined in: src/lines.ts:88


mapLines

mapLines<X>(stream: ReadableStreamTree, map: (x: string) => X): Promise<X[]>

Maps lines from [[stream]]. Used to implement readLines.

Type parameters

Name
X

Parameters

Name Type Description
stream ReadableStreamTree The stream to read lines from.
map (x: string) => X -

Returns: Promise<X[]>

Defined in: src/lines.ts:50


mapLinesWithHeader

mapLinesWithHeader<X, H>(stream: ReadableStreamTree, map: (x: string) => X, header?: (y: string) => H, ret?: X[]): Promise<[H | undefined, X[]]>

Parses lines (with header) from [[stream]]. Used to implement readLinesWithHeader.

Type parameters

Name
X
H

Parameters

Name Type Default value Description
stream ReadableStreamTree - The stream to read lines from.
map (x: string) => X - -
header? (y: string) => H - -
ret X[] [] -

Returns: Promise<[H | undefined, X[]]>

Defined in: src/lines.ts:60


parseLines

parseLines(stream: ReadableStreamTree, callback: (x: string) => void): Promise<void>

Parameters

Name Type
stream ReadableStreamTree
callback (x: string) => void

Returns: Promise<void>

Defined in: src/lines.ts:34


readLines

readLines<X>(fileSystem: FileSystem, url: string, map: (x: string) => X): Promise<X[]>

Reads every line from a file.

Type parameters

Name
X

Parameters

Name Type Description
fileSystem FileSystem -
url string The URL of the file to read lines from.
map (x: string) => X Callback called for each line.

Returns: Promise<X[]>

Defined in: src/lines.ts:10


readLinesWithHeader

readLinesWithHeader<X, H>(fileSystem: FileSystem, url: string, map: (x: string) => X, header?: (x: string) => H, ret?: X[]): Promise<[H | undefined, X[]]>

Reads every line from a file, treating the first line as a header.

Type parameters

Name
X
H

Parameters

Name Type Default value Description
fileSystem FileSystem - -
url string - The URL of the file to read lines from.
map (x: string) => X - Callback called for every line succeeding the header.
header? (x: string) => H - Callback called for the first line.
ret X[] [] -

Returns: Promise<[H | undefined, X[]]>

Defined in: src/lines.ts:24


writeContent

writeContent(fileSystem: FileSystem, url: string, value: string): Promise<void>

Writes the string to a file.

Parameters

Name Type Description
fileSystem FileSystem -
url string The URL of the file to serialize the string to.
value string The string to serialize.

Returns: Promise<void>

Defined in: src/lines.ts:107