Jonathan Lennox
07/09/2024, 8:14 PMJonathan Lennox
07/09/2024, 8:16 PMreadAsArrayBuffer
(it wasn't with readAsText
) but I crash with "oh, snap" (presumably out of memory) when I try to use decodeToString
on it. Is there any way to get it as a CharSequence
that I could use splitToSequence
on? Or any other suggestions?Edoardo Luppi
07/09/2024, 9:39 PMslice()
the File
in multiple chunks.Edoardo Luppi
07/09/2024, 9:39 PMJonathan Lennox
07/09/2024, 9:41 PMEdoardo Luppi
07/09/2024, 9:45 PMreadAsText(chunk)
instead of readAsArrayBuffer
to simplify it, and then somehow manage the EOL chars.Edoardo Luppi
07/09/2024, 9:47 PMEdoardo Luppi
07/09/2024, 9:48 PMit wasn't withYou mean it did not load the entire content? That's strange.readAsText
Jonathan Lennox
07/09/2024, 9:49 PMreadAsText
is to call the event callback with an empty string if it's too big for the memory.Edoardo Luppi
07/09/2024, 9:49 PMJonathan Lennox
07/09/2024, 9:49 PMJonathan Lennox
07/09/2024, 9:50 PMEdoardo Luppi
07/09/2024, 9:50 PMI just noticed this with some rather large datasets: a 257MB file reads but a 459MB file returns an empty string, Chrome 49
Jonathan Lennox
07/09/2024, 9:51 PMreadAsArrayBuffer
loads the file fine (presumably it's just mmap'ing it or something internally) but my attempt to convert it to text fails with "oh snap"Edoardo Luppi
07/09/2024, 9:52 PMreadAsText
fails, although the latter doesn't crash the pageJonathan Lennox
07/09/2024, 9:52 PMEdoardo Luppi
07/09/2024, 9:52 PMJonathan Lennox
07/09/2024, 9:53 PMEdoardo Luppi
07/09/2024, 9:54 PMJonathan Lennox
07/09/2024, 9:54 PMEdoardo Luppi
07/09/2024, 9:55 PMJonathan Lennox
07/09/2024, 9:56 PMEdoardo Luppi
07/09/2024, 9:57 PMJonathan Lennox
07/09/2024, 9:58 PMEdoardo Luppi
07/09/2024, 10:01 PMBuffer
, and then you can use Source.readString()
.
Or you can even wrap your JS buffer into a custom Source
implementation to avoid copying bytes.Edoardo Luppi
07/09/2024, 10:04 PMEdoardo Luppi
07/09/2024, 10:05 PMEdoardo Luppi
07/09/2024, 10:10 PMturansky
07/10/2024, 9:37 AM