file functionality in generator