JS API: file size limits for file access?

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

JS API: file size limits for file access?

Post by piet66 »

Are there file size limits for file access using JS API, like
http:.../JS/Run/loadObject("filename")
and
http:.../JS/Run/saveObject("filename")
?

What are the limits and what do we get back when limit is exceeded?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: JS API: file size limits for file access?

Post by PoltoS »

Limit is the memory limit of your Pi. You get an exception if it is exceeded. Otherwise there are no limits.

But JSON is a bad format for big files
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: JS API: file size limits for file access?

Post by piet66 »

I tested loadObject with the standard ZWay files. 4 of them return null:
http://IP:8083/JS/Run/loadObject('dedevices.json')
http://IP:8083/JS/Run/loadObject('endevices.json')
http://IP:8083/JS/Run/loadObject('zwayo ... ckets.json')
http://IP:8083/JS/Run/loadObject('zwayp ... ckets.json')

These 4 are the largest files of all:
-rwxr-xr-x 1 4142694 Apr 19 13:49 dedevicesjson-b02fc6609e0022e8f55ff6bb5b853d35.json
-rwxr-xr-x 1 4103417 Apr 19 13:49 endevicesjson-7904daacdb872d656b01c6c9eddd3a48.json
-rwxr-xr-x 1 621220 Aug 11 08:31 zwayoriginPacketsjson-2ad2998bc2cb543d29ac586cec215398.json
-rwxr-xr-x 1 817011 Aug 11 08:31 zwayparsedPacketsjson-f1aed46af7fae1368e78db7768e4d9e5.json

For saveObject there seems to be a buffer size limit of about 6000 bytes. Larger buffers cause an error {"readyState":0,"status":0,"statusText":"error"}.
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: JS API: file size limits for file access?

Post by PoltoS »

This should be HTTP limit and not API
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: JS API: file size limits for file access?

Post by piet66 »

Is it a limit of ZWay webserver? Where is it configured?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: JS API: file size limits for file access?

Post by piet66 »

piet66 wrote:
11 Aug 2019 10:22
I tested loadObject with the standard ZWay files. 4 of them return null
It's not the filesize but the filename. After storing those file with a different valid filename it works.
piet66 wrote:
11 Aug 2019 11:47
Is it a limit of ZWay webserver? Where is it configured?
It's obviously the ZWay embedded webserver. I tested it with netcat.
Apache server also has such a limit: LimitRequestLine 8190
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: JS API: file size limits for file access?

Post by PoltoS »

We should use mongoose default values
piet66
Posts: 266
Joined: 04 Feb 2017 17:00

Re: JS API: file size limits for file access?

Post by piet66 »

PoltoS wrote:
14 Aug 2019 04:32
We should use mongoose default values
Of course, but I found it nowhere documented.
Now looked into mongoose code: #define MG_MAX_HTTP_REQUEST_SIZE 8192
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 10 (buster, 32bit)
RaZberry by Z-Wave.Me ZW0700 7.20.00 07.38/1766938484 1025/257
Z-Way version v3.2.3 from 2022-04-06 04:56:23 +0300
Post Reply