11 lines
339 B
TypeScript
11 lines
339 B
TypeScript
export async function readLines(path: string) {
|
|
const decoder = new TextDecoder("utf-8");
|
|
const inputData = await Deno.readFile(path);
|
|
const input = decoder.decode(inputData);
|
|
|
|
// console.log(input.substring(0,50) + '...');
|
|
const lines = input.split('\n')
|
|
.filter( l => l.trim() !== '');
|
|
|
|
return lines
|
|
} |