I have used 'download=1' to direct download a public file in SharePoint. It is working fine but this is working for .docx, .xlsx & .zip files only, it is not working for images & .txt file. So i have used following option & it is working for all files.
Public URL: https://xxxxx.sharepoint.com/:f:/g/EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w?e=tPfJVv
you need to get file Unique id from this URL i.e. EkcBNxpXTKZJrg3xdBWlFBEBlgVj4FInALm_JVs4kYfK8w
and update URL to:
You will also need to update the name of the Sharepoint site in the URL above (here: "Developer") to match the site your file is located in.