Uploading flashing files and folders - T-vK/NodeMCU-Express GitHub Wiki

For uploading your folders and files, I can highly recommend NodeMCU-Tool. A tool that I can not recommend is ESplorer. Although it has a graphical user interface, it is terribly buggy.

NodeMCU-Tool

Installing NodeMCU-Tool

To install NodeMCU-Tool, simply install NodeJS. Then open a terminal or command prompt and install node-gyp as described here. Then run npm install nodemcu-tool -g.

Configuring NodeMCU-Tool for your project

In your project's folder, create a new file called .nodemcutool.
Now copy-paste this into that file:

{
    "baudrate": "115200",
    "port": "/dev/ttyUSB0",
    "compile": true,
    "minimize": true,
    "keeppath": true,
    "connection-delay": 300
}

Replace /dev/ttyUSB0 with the name of your COM port.
If you don't want to compile or minimize your code set them to false instead.
connection-delay is only required on some developer boards (Witty cloud for example).

Uploading your files to your ESP

Open a terminal and change the directory to your project's directory. Now run nodemcu-tool upload init.lua to upload your init.lua file.
Or run nodemcu-tool upload *.lua to uplaod all .lua files in the current directory.
Or run nodemcu-tool upload http/* to upload a folder called http.

Notes:

  • Using * will not upload files/folders recursively, so you may have to do:
    nodemcu-tool upload http/* and nodemcu-tool upload http/*/* and maybe even nodemcu-tool upload http/*/*/* etc.

  • Path names are very limited. Keep them as short as possible!

  • Your folders won't actually be folders on the ESP's storage. For instance if you upload http/js/test.js and http/js/test2.js, two separate files will be created in the root directory of your ESP and these files will have the whole path as their actual file name, meaning the file name will contain slashes.

    So this:

    .
    ├── http
    │   └── js
    │       ├── test.js
    │       └── test2.js
    ├── HttpServer.lua
    └── init.lua
    

    would become this:

    .
    ├── http/js/test.js
    ├── http/js/test2.js
    ├── HttpServer.lua
    └── init.lua