I am trying to develop a Safari Extension that can save a file from a webpage into persistent storage with minimal user input.
Problem
I don't know how to code it so that it results like manually saving a file from the "Sources" tab in Safari Web Inspector.
Equivalent manual steps
- show source or resources of page
- by keying
⌥⌘Uor⌥⌘A - or by navigating to Web Inspector then "Sources"
- by keying
- save the file
- by selecting the file then by keying
⌘S - or by secondary clicking the file then clicking "Save File"
- by selecting the file then by keying
Alternative solution
Javascript get the URL of files from the HTML elements and then pass the URL to a downloader, but I don't want to download it after the browser already did. I want to save the already downloaded temporary files to reduce network trafficking.
Theory
From my current understanding, when a webpage is viewed, Safari downloads the files and loads them in memory.
Other
I tried multiple ways to Google it but I keep getting only unrelated results.
Thank you for your time to read this and in advance.