@wholebuzz/fs / Exports / lines
▸ appendLine(fileSystem: FileSystem, urlText: string, line: string): Promise<FileStatus | null>
Appends a line of text to a file.
| Name | Type |
|---|---|
fileSystem |
FileSystem |
urlText |
string |
line |
string |
Returns: Promise<FileStatus | null>
Defined in: src/lines.ts:88
▸ mapLines<X>(stream: ReadableStreamTree, map: (x: string) => X): Promise<X[]>
Maps lines from [[stream]]. Used to implement readLines.
| Name |
|---|
X |
| 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<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.
| Name |
|---|
X |
H |
| 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(stream: ReadableStreamTree, callback: (x: string) => void): Promise<void>
| Name | Type |
|---|---|
stream |
ReadableStreamTree |
callback |
(x: string) => void |
Returns: Promise<void>
Defined in: src/lines.ts:34
▸ readLines<X>(fileSystem: FileSystem, url: string, map: (x: string) => X): Promise<X[]>
Reads every line from a file.
| Name |
|---|
X |
| 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<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.
| Name |
|---|
X |
H |
| 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(fileSystem: FileSystem, url: string, value: string): Promise<void>
Writes the string to a file.
| 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