JS API: file size limits for file access?

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

JS API: file size limits for file access?

Post by piet66 » 08 Aug 2019 09:47

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 9 (stretch)
ZMEERAZ 2016, SDK Version: 6.51.03, Serial API Version: 05.00
Z-Way version v3.0.0 from 2019-07-18 02:13:01 +0300 (build 146fa9b44605907737b17032131987cab573da1f)

User avatar
PoltoS
Posts: 5093
Joined: 26 Jan 2011 19:36

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

Post by PoltoS » 09 Aug 2019 02:50

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: 94
Joined: 04 Feb 2017 17:00

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

Post by piet66 » 11 Aug 2019 10:22

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 9 (stretch)
ZMEERAZ 2016, SDK Version: 6.51.03, Serial API Version: 05.00
Z-Way version v3.0.0 from 2019-07-18 02:13:01 +0300 (build 146fa9b44605907737b17032131987cab573da1f)

User avatar
PoltoS
Posts: 5093
Joined: 26 Jan 2011 19:36

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

Post by PoltoS » 11 Aug 2019 11:13

This should be HTTP limit and not API

piet66
Posts: 94
Joined: 04 Feb 2017 17:00

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

Post by piet66 » 11 Aug 2019 11:47

Is it a limit of ZWay webserver? Where is it configured?
Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 9 (stretch)
ZMEERAZ 2016, SDK Version: 6.51.03, Serial API Version: 05.00
Z-Way version v3.0.0 from 2019-07-18 02:13:01 +0300 (build 146fa9b44605907737b17032131987cab573da1f)

piet66
Posts: 94
Joined: 04 Feb 2017 17:00

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

Post by piet66 » 12 Aug 2019 10:53

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 9 (stretch)
ZMEERAZ 2016, SDK Version: 6.51.03, Serial API Version: 05.00
Z-Way version v3.0.0 from 2019-07-18 02:13:01 +0300 (build 146fa9b44605907737b17032131987cab573da1f)

User avatar
PoltoS
Posts: 5093
Joined: 26 Jan 2011 19:36

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

Post by PoltoS » 14 Aug 2019 04:32

We should use mongoose default values

piet66
Posts: 94
Joined: 04 Feb 2017 17:00

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

Post by piet66 » 15 Aug 2019 10:13

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 9 (stretch)
ZMEERAZ 2016, SDK Version: 6.51.03, Serial API Version: 05.00
Z-Way version v3.0.0 from 2019-07-18 02:13:01 +0300 (build 146fa9b44605907737b17032131987cab573da1f)

Post Reply