antipole2 / JavaScript_pi

JavaScript plugin for OpenCPN
GNU General Public License v3.0
2 stars 4 forks source link

add parameter start, length to readtextfile() #59

Closed pterocarya-fraxinifolia closed 6 months ago

pterocarya-fraxinifolia commented 1 year ago

the readtextfile() seems to be limited to a size of 64k. If this is the case, if would be helpful to add (optional?) parameters start , length in order to read chunks of a file larger than 64k

antipole2 commented 1 year ago

Looks like this should be possible but not a five minute job. I must attend to cruise planning, so may be some delay in implementing. Temporary work-around: chop file up into instalments and read each.

pterocarya-fraxinifolia commented 1 year ago

this is exactly what I did :-) so: no need to hurry with the implementation

antipole2 commented 12 months ago

@pterocarya-fraxinifolia Can you explain what sort of data exceeding 64k you are processing? And what is the symptom when you exceed 64k? I could implement optional start and length parameters. Am also considering a line-based approach: readTextFile(file [, startLine, numberOfLines]) but not sure if that is more useful.

pterocarya-fraxinifolia commented 12 months ago

Hi Tony, thanks for working on this.

I was actually trying to replay previously recorded NMEA data. The file for one day can actually be some mbytes large. So, my data is ASCII text with limited length lines.

The line-based approach would work, but I guess I would prefer reading arbitrary chunks of data byte-based and have my own control on how to split data into lines and handling of incomplete records at the block borders.

BR Bernd

Am Di., 10. Okt. 2023 um 14:54 Uhr schrieb Tony @.***>:

@pterocarya-fraxinifolia https://github.com/pterocarya-fraxinifolia Can you explain what sort of data exceeding 64k you are processing? And what is the symptom when you exceed 64k? I could implement optional start and length parameters. Am also considering a line-based approach: readTextFile(file [, startLine, numberOfLines]) but not sure if that is more useful.

— Reply to this email directly, view it on GitHub https://github.com/antipole2/JavaScript_pi/issues/59#issuecomment-1755369531, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5DI24LWTD67VHAJZUI5TX6VAPDAVCNFSM6AAAAAAVWIMQTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJVGM3DSNJTGE . You are receiving this because you were mentioned.Message ID: @.***>

-- Dr. Bernd Franke @.*** +49 176 78 95 98 56

antipole2 commented 9 months ago

@pterocarya-fraxinifolia Please install the latest alpha build of the plugin from my alpha repository.

You can then handle large files this way. Let me know how it works for you. FileObject

pterocarya-fraxinifolia commented 9 months ago

Hi Tony, thanks a lot for the implementation: it looks great and does the job for me. Bernd

Am Mi., 3. Jan. 2024 um 12:53 Uhr schrieb Tony @.***>:

@pterocarya-fraxinifolia https://github.com/pterocarya-fraxinifolia Please install the latest alpha build of the plugin from my alpha repository https://cloudsmith.io/~opencpn/repos/javascript-alpha/packages/.

You can then handle large files this way. Let me know how it works for you. FileObject.png (view on web) https://github.com/antipole2/JavaScript_pi/assets/11269557/4c2eb599-41ea-4f75-a544-f1d3f0a18aa0

— Reply to this email directly, view it on GitHub https://github.com/antipole2/JavaScript_pi/issues/59#issuecomment-1875255883, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5DI26RADSDSYLG7ARRRDYMVBEDAVCNFSM6AAAAAAVWIMQTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGI2TKOBYGM . You are receiving this because you were mentioned.Message ID: @.***>

-- Dr. Bernd Franke @.*** +49 176 78 95 98 56

antipole2 commented 9 months ago

Can you confirm if you are using my .getTextLine( )? [You might have used.getText(start, count) and retained your own block management.]

pterocarya-fraxinifolia commented 9 months ago

I indeed used .getText() initially, but .getTextLine() works as well on my Windows 10 environment. I will retest both on Debian in the next days.

Am Do., 4. Jan. 2024 um 14:59 Uhr schrieb Tony @.***>:

Can you confirm if you are using my .getTextLine( )? [You might have used .getText(start, count) and retained your own block management.]

— Reply to this email directly, view it on GitHub https://github.com/antipole2/JavaScript_pi/issues/59#issuecomment-1877138438, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5DI7FVIB63AO36MSY53LYM2YUHAVCNFSM6AAAAAAVWIMQTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZXGEZTQNBTHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Dr. Bernd Franke @.*** +49 176 78 95 98 56