-
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.
Implement most of external data seeding
- Loading branch information
1 parent
737ef7a
commit ae3b1d4
Showing
28 changed files
with
410,426 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ node_modules | |
/postgres-data | ||
|
||
/app/styles/tailwind.css | ||
|
||
/app/lib/vendor | ||
/app/lib/dic |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,25 @@ | ||
import fs from "fs"; | ||
import readline from "readline"; | ||
|
||
export type LineReader = readline.Interface; | ||
|
||
export async function getLineReader(filename: string): Promise<LineReader> { | ||
const fileStream = fs.createReadStream(filename); | ||
|
||
const rl = readline.createInterface({ | ||
input: fileStream, | ||
// recognize all instances of CR LF | ||
// ('\r\n') in input as a single line break. | ||
crlfDelay: Infinity, | ||
}); | ||
return rl; | ||
} | ||
export async function forEachLine( | ||
filename: string, | ||
callback: (line: string) => void | ||
) { | ||
const rl = await getLineReader(filename); | ||
for await (const line of rl) { | ||
callback(line); | ||
} | ||
} |
Oops, something went wrong.