[web] convert convert-to-file endpoint into a script GitOrigin-RevId: 5babebae5df8510b83f09ec4a2bb4064cca5ec75