When exactly does the data gets wiped out once bootloader is unlocked? I've heard as well as experienced that unlocking the bootloader of an Android device wipes the device's data completely, and makes it like the stock one. However, I'm interested in knowing when exactly does this data wipe take place? 

Does it happen when we issue the command:

fastboot oem unlock


or, when booting into the Android after completing the last step?

I've asked my question because this question is concerned with recovering data (seems to be from an unlocked device) and an answer it received is:


  You could flash TWRP recovery (not sure if available for your device) which has an in-built file manager and and terminal and move files to any usb storage.


My point is, hypothetically, in such case I would first unlock the bootloader, and then flash the custom recovery without rebooting fastboot. Then I will boot into the custom recovery directly from fastboot.

Now, would I be able to see my data or not, and when exactly would this wipe happen?
This may vary with the device, but on Nexus devices, as soon as you accept the bootloader unlock on your device after issusing fastboot oem unlock, the device is wiped so you would not be able to see the data in TWRP. This is evident because after issuing the fastboot oem unlock command to a Nexus device and confirming the operation on the device, the following text is printed to the terminal: Unlocking bootloader... erasing userdata... erasing userdata done erasing cache... erasing cache done Unlocking bootloader done!