History of Joseph the Carpenter

The History of Joseph the Carpenter ("Historia Josephi Fabri Lignari") is a compilation of traditions concerning Mary (mother of Jesus), Joseph, and the "holy family," probably composed in Byzantine Egypt in Greek in the late sixth or early seventh centuries, but surviving only in Coptic and Arabic language translation. The text bears witness to the belief in the perpetual virginity of Mary.
It is one of the texts within the New Testament apocrypha concerned with the period of Jesus' life before he was 12.
Contents.
The text is framed as an explanation by Jesus on the Mount of Olives concerning the life of Joseph, his stepfather. Agreeing with Mary's continued virginity, the text proclaims that Joseph had four sons (Judas, Justus, James, and Simon) and two daughters (Assia and Lydia) by a previous marriage. 
After this basic background, the text proceeds to paraphrase the Gospel of James, stopping at the point of Jesus' birth. The text states that Joseph was miraculously blessed with mental and physical youth, dying at the age of 111. His oldest sons (Justus and Simon) get married and have children, and likewise his two daughters get married and live in their own houses. 
Joseph's death takes up a substantial portion of the text. He first lets out a significant prayer, including in his last words a series of lamentations about his carnal sins. About 50% of the work is an extension of the death scene, in which the angel of death, as well as the archangels Michael and Gabriel, appear to him. At the conclusion of the text, Jesus affirms that Mary remained a virgin throughout her days by addressing.
Age and surviving versions.
Some information indicates the text was written in Egypt in the fifth century. Two versions survive, one in Coptic, the other in Arabic, with the Coptic version likely being the original. Much of the text is based on material in the Gospel of James.
Correlation with 3rd-century apocryphon.
The early third century apocryphal "First Apocalypse of James" from the Nag Hammadi library states: Jesus speaking to James, "For not without reason have I called you my brother, although you are not my brother materially." This adds an additional record of Mary's relationship to Jesus' brothers, allowing the explanation of her perpetual virginity.