How to read a text file line by line using Expo File System?

Viewed 405

I have a large .txt file (815 KB) where each line has a number, for example:

013
17
7783014
8156

I want to read it and add each number to a local database table.

I managed to read it using FileSystem.readAsStringAsync(file.uri) but it is a lot of data, it doesn't seem like a good idea to create an array using .split('\n') and then iterate it.

There is an options object in the docs, but I don't know the number of bytes (length) that each line has.

What can I do to read line by line or at least a more performative approach than reading the whole file, then creating an array and then iterating it?

0 Answers
Related