Chrome download API: default location for the save as window - google-chrome-extension

On my Chrome extension I have an option to download a file on a specific path (set by the user) but I've seen that is impossible to download a file outside the download directory, so I decided to use the save as option but when the dialog opens it is on the download directory but I want it to be on the folder previously chosen by the user

Related

Cannot load extension with file or directory name _metadata

I get the .crx file of an extension name simulty in order to edit the source ( for personal use )
So i have follow all the steps :
get .crx
unzip .crx
Load in Google chrome extension
But when i try to load i have the same error " Cannot load extension with file or directory name _metadata "
There is a _metadata and a locales files in the directy and it seems that google chrome don't want to load it. Is there any way to take off the "" ... and load it ? I heard that its a google chrome bug...
Anybody find the solution ?
Or know any other way to edit the source of an chrome extension?
You can just delete the _metadata folder when loading an unpacked extension.
It contains cryptographic hashes of files to ensure they have not been modified. It is not expected to be present for an unpacked extension (it's automatically added by CWS when generating a crx), so just delete it.
I would also suggest editing the manifest to wipe update_url and key fields (if present), to completely dissociate with the original extension.

Run Chrome Extensions using command prompt

Is it possible to run a chrome extension from command line?
I need to automate the process for my software, and my software will need to run that extension with a particular parameter.
I am using a Chrome Extension 'APK Downloader' by Yogi. The Extension works like this:-
"If a page contains any .apk file link, then when I click on the extension's icon on the address bar, it starts direct download of that .apk file"
Now, I have my software that needs some .apk file to download [The software will have the package name of the .apk file to be downloaded, which is used by the extension to generate a download link]. It will be an automatic process. So, I need to know if it is possible to pass a parameter to the extension automatically, and make the extension to work without clicking on it.
Is it possible to do so??
Unpacked extension can be loaded using the --load-extension= flag.
What I usually do is chromium --user-data-dir=/tmp/someuniquedirname --load-extension=path/to/extension --no-first-run.
The --user-data-dir= flag is used to specify a non-default user data directory, to minimize conflicts between your existing browser profile and the test directory. You can omit this flag if you want to use your default user profile.
The --no-first-runflag prevents the first run UI from showing up (e.g. the bubble that explains how to use the omnibox, and a "Getting Started" page that opens in a new tab).
You can load multiple extensions by separating the paths by commas, e.g. chromium --load-extension=path/to/one/extension,path/to/another/extension.
I have published some shell scripts and a convenience extension to speed up (manual) testing of Chrome extensions. Take a look at https://github.com/Rob--W/extension-dev-tools/tree/master/chrome.
it helps to open extension normally and after that hit F12 (dev tools) to see actual url...
having that i can, for example load "Selenium IDE" chrome extension as
(run from command prompt)
"C:\Program Files (x86)\Google\Chrome\Application\new_chrome.exe" chrome-extension://mooikfkahbdckldjjndioackbalphokd/index.html
on a mac:
osascript <<EOD
set theURL to "chrome://extensions/"
tell application "Google Chrome"
if windows = {} then
make new window
set URL of (active tab of window 1) to theURL
else
make new tab at the end of window 1 with properties {URL:theURL}
end if
activate
end tell
EOD
Question answered here:
https://superuser.com/a/979678

Open a local file in user's folder

I'm trying to open Chrome's Preferences file, a JSON text file in Chrome's folder on a Windows installation.
The thing is that I need to know the username to get the actual path.
Is there a way to acces a file in the user's folders tree without prompting for it, and without running any out of browser code?
I tried to use file:// protocol to access a relative path, but it seems file:// relative paths don't work on Windows.
Thank you

Is there a way to use a downloaded (xml-esque) file in an extension?

I'm attempting to write an emusic download manager extension for Chrome. This would essentially involve parsing the .emx file (xml-esque) downloaded from the site to get the temporary music file URL.
I've gone through everything I can find online about extensions working with downloads, but the problem comes in that the .emx file isn't directly accessible from the web. The link to download it seems to pass through a counter for your account so that it can deduct the cost, and then it pushes a file 0.emx to be downloaded. It doesn't seem to work with any hotlinking, even copying and pasting the button's destination URL into the same browser tab.
I think the only way to get the file is to wait for the 0.emx file to be pushed. Is there any way I can use an extension to intercept that file before it goes to the downloads folder or use it after it's already downloaded?
Thanks!

Turn a folder into a bundle/package for iTunes file sharing

iTunes File Sharing for iOS apps allows users to pull down folders from apps via syncing to the device but it doesn't allow the reverse and load in directories from a computer to the device. Is there a way to make a in-app folder a bundle/package like a .app package so that the OS thinks it is a file rather than a directory?
From what I can tell GarageBand for the iPad is doing exactly this for files off the device. The context menu on the exported file in the Finder allows you to "Show Package Contents".
I appended a made up extension to the directory path and it shows up in iTunes as a file, but on export it comes out as a directory.
The following worked for me:
Rename folder to <foldername>.pkg
Drag it into the file sharing panel
In the file sharing panel, rename it back to <foldername>
I just found! Windows users can use iExplorer!
Start iExplorer (available at this URL http://www.macroplant.com/iexplorer/)
Connect iOS device to PC using USB cable
Find this folder: "Apps" > [YOUR_APP] > "Documents"
Drag and Drop the bundle/package into "Documents" folder
Note: A bundle/package on Mac is simply a folder on Windows. There is no need to have any file extension like .pkg on Windows.

Resources