Can you help me out to understand if this is possible with ESP8266 / 32 ?

I have a main binary that i upload to the chip, let's call it **A** - that's done from arduino.

**A** starts to work, but communicates every couple of minutes with central server polling for a *task*.

If there is a task - let's call it **B** 

**A** downloads it and stores it on SPIFFS.

Now what should happen is that **A** uploads it, reboots and **B** starts to work.

When **B** finishes it loads up again **A** and the circle closes - this process goes on forever.

Questions:

1) Is it possible that a stored on SPIFFS binary file can be uploaded to the chip? Like OTA does via www.

2) Can i somehow store **A** onto the SPIFFS, so that when **B** finishes i reupload **A** ?

Thanks for any input into this