-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS library sometimes uploads files with 0 bytes #83
Comments
HI @czenker thanks for your report. a reset during connection is not projected to be handled by the library. imho the only reliable solution is to wrap the file transfer helper within an instance of the current connection but this require stateful components within the library. at the moment i would mark it as bug and wont-fix since the use-case is very limited |
Hi @AndiDittrich. Thanks for the fast response. I think the main issue here is that it is very easy to get nodemcu-tool (the JS library) into a state where the upload does not work. If there was a way to programatically recover from it, I would not consider it a too big issue. But it is not possible to recover from that state without restarting the NodeJS(!) application. |
ok. |
Alright. This decision makes sense then. ProgrammaticUsage.md should be updated, because it states
|
thanks, i've added a usage notice |
Environment
Fedora 33
ESP8266
Please use the least recent version to validate the issue
3.2.1
14.15.4
3.0.0
Issue Description
When using NodeMCU-Tool as library for JS, the
upload
function will create files with0 byte
size if any of the following conditions is met:Expected Behavior
Files are created on the board...
Current Behavior
... in some cases they have a size of
0 bytes
.Steps to Reproduce
example.txt
with a non empty content0 bytes
Example
Detailed Description
Core problem is that
_isTransferWriteHelperUploaded
is tracked as a global variable and is never reset. It should handle device changes, reboots, disconnections, etc.NodeMCU-Tool/lib/connector/upload.js
Line 9 in f160e0a
Side note: The
download
function does not show this behavior.Possible Solution
Remove the check, if transferWriteHelper was written and write it before every single file upload.
An alternative approach is to reset
_isTransferWriteHelperUploaded
whenever a connection to a new device is established or it is reset. But this would create dependencies between unrelated modules. And it would not cover the case when the user or a script issues a reset through theexecute
function.A different alternative is to check if
_G.__nmtwrite
exists on NodeMCU before every write. But I would disregard that, because if we need toexecute
a lua script, we might as well just write the transferWriteHelper.Pull-request inbound.
The text was updated successfully, but these errors were encountered: