How does a silkworm make its silk?
The silkworm is really the caterpillar of the silk moth. It spins a cocoon of silk just as other moth caterpillars do, but its silk is especially fine. The silkworm makes its silk by oozing a long thread of gluey liquid out of its mouth.
As soon as the liquid touches the air, it hardens into a silk thread. Then the silkworm spins the silk thread around and around its body to form a cocoon.
To get the silk, people give the cocoon a stream both to loosen the gum that holds the thread in place. Then they can unwind the cocoon. From the thread, fine silk cloth is woven.–Dick Rogers