In my project I put into the init.lua a small TCP server that listens on port 2323 and posts to the terminal (taken from the nodemcu website example). How can I use this to upload files to the module? Since I have access to the terminal just like a serial monitor, I think this should be possible.
s=net.createServer(net.TCP,180)
s:listen(2323,function(c)
function s_output(str)
if(c~=nil)
then c:send(str)
end
end
node.output(s_output, 0)
-- re-direct output to function s_ouput.
c:on("receive",function(c,l)
node.input(l)
--like pcall(loadstring(l)), support multiple separate lines
end)
c:on("disconnection",function(c)
node.output(nil)
--unregist redirect output function, output goes to serial
end)
print("Welcome to NodeMCU world.")
end)thanks
Leo