How to increase the number of concurrent downloads initiated by an extension? - google-chrome

I have an extension which initiates downloads in its background page. The current problem is when you call chrome.downloads.download for, say 100 times, it will download 5 files at a time until all 100 files have been downloaded.

I had same problem with images and I found some answer which works for me:
Press "Windows-R" to open the Run tool. Type "regedit" into the box, click "OK" and then, if prompted, confirm the operation or type your administrator password to open the Registry Editor.
Double-click the "HKEY_CURRENT_USER" directory in the left pane. Double-click the "Software" sub-directory, double-click "Microsoft," double-click "Windows," double-click "CurrentVersion" and then single-click "Internet Settings."
Open the "Edit" menu, move your mouse cursor over "New" and then click "DWORD (32-bit) Value" to create a new registry entry. Name the entry "MaxConnectionsPerServer" (omit the quotes) and double-click it to view its properties.
Select the "Decimal" option from the "Base" section of the "Edit DWORD (32-bit) Value" dialog that opens up. Type the number of simultaneous downloads you want into the "Value Data" box, such as "10" (again, omit the quotes) and click "OK."
Repeat the previous two steps with only one change: This time name the new registry entry "MaxConnectionsPer1_0Server". Close the Registry Editor, close any open programs and restart your computer. The simultaneous download limit change will now go into effect.
For effect I added 650 connections or downloads and it worked for me downloaded 650 pictures from some html file with this code:
var a = document.getElementsByTagName('a');
for(var i=0; i<a.length; i++){
var myimg = a[i].getElementsByTagName('img')[0].src;
a[i].href = myimg;
a[i].download = myimg;
a[i].click();
}

HERE IS THE ANSWER... I almost gave up then I stumbled upon it. Settings >> Advanced >> Downloads >> Unclick "ask where to save each file before downloading". Done! Now you can have virtually unlimited concurrent downloads (given your also using a download manager addon or other). This was on a Mac - no idea how it is handled on Windows.

Unfortunately you can't control that. It's a limitation of chrome's browser. It would be a security issue if you can flood the user's browser with an unlimited number of downloads.

Related

How to force Chrome to always open as application without command line or shortcut

How are you?
I hope you are safe and sound.
I was wondering how can edit the Windows 10 in order to make chrome/edge to always open always open as the following flags:--app and -userdatadir=C:/temp
Don't want via shortcut or command line.
Thanks.
From your previous comment, I understand that you want to set the User Data Directory using the registry key for the MS Edge Chromium browser.
Here, I am showing you 2 approaches. Using registry key and using group policy.
Below are the steps to set the User Data Directory using the registry key.
Open Registry editor.
Browse to the location below.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge
Create a new string value and name it as UserDataDir.
Doubble click on it and set the directory value.
Close the Registry editor and relaunch the MS Edge browser.
Below are the steps to set the User Data Directory using the Group policy.
Open Local group policy editor.
Browse to the location below.
Computer configuration -> Administrative templates -> Microsoft Edge
Find and double click on Set the user data directory policy.
Click on enabled option and then set the desire value.
Close the Local group policy editor and relaunch the MS Edge browser.
Reference:
Create Microsoft Edge user data directory variables

PhpStorm Find all Instances in current remote file

I am trying to get a list of search results for a string in the current file which is opened from a remote host. CTRL F only highlights the instances in the doc but does not give me an easy overview. If I have a file downloaded to my project folder I can press CTRL SHIFT F for "find in path" and then CTRL ENTER to open the find window. complicated but better than nothing.
Is there a simple "find all in current file" command, disregarding whether its a project file or a remote file?
Click on All button on Find toolbar and it will list all found entries in a standard "Find Results" toolwindow.

How to open and save files

Is there a way to quickly open files in sublime text2?
At the moment I open files like this.
I open my terminal and enter
subl source/myproj/myfile.rs
Can I do this inside of sublime text2/3?
Also when I want to create a new file in source/myproj/ I usally press ctrl + n to create a new window and then I hit ctrl + s to save and name the file. The problem is when I hit ctrl + s my file system dialog opens and I have to use my mouse.
I think I saw someone using vim and he just could say source/myproj/mynewfile.rs and then the file would be created.
Is this possible in sublime text 2/3?
To quickly open a file in your current project, you can hit Ctrl+P and start writing the filename. This will sort through the files in your project and give you a little list, most likely the one you are looking for is pre selected, but if not, it is somewhere near the topmost options to select from, use arrow key down and highlight it, press enter and you just opened that file.
Another option to quickly create a file is using the AdvancedNewFile plugin.
When you hit Ctrl+n, it asks near the bottom of the window for a path and filename, once you enter it, it opens the new tab with the file already created, not an untitled file to later use system dialog to save to disk.

How do I make Sublime Text 2 prompt me before exit?

There have been too many times where I have accidentally clicked the X on the top right window in Sublime Text 2. I then loose my undo/redo history.
Edit: I have tried to set hot_exit to false in default and user settings.
Look for hot_exit in Preferences.sublime-settings
// Exiting the application with hot_exit enabled will cause it to close
// immediately without prompting. Unsaved modifications and open files will
// be preserved and restored when next starting.
//
// Closing a window with an associated project will also close the window
// without prompting, preserving unsaved changes in the workspace file
// alongside the project.
"hot_exit": true,
and set it to false.
Install the plugin Local History.
Every time you modify a file, a copy of the old contents is kept in
the local history.
Either do it through Package Control (If you don't have it already, install it)
Or get it on Github

How to delete indexedDB?

I'm working in a project which involves using IndexedDB.
As I'm begining to know this technology, I need to be able to delete an indexedDB by hand so I can start over.
I found the way to do it in Firefox, but I can't find the way for Google Chrome.
I tried deleting the content of this folder (I'm using Mac):
{home}/Library/Application Support/Google/Chrome/Default/IndexedDB
but it seems Chrome stil have the DB anywhere so I can't start over.
I've had success running the following in Chrome:
indexedDB.deleteDatabase('DB NAME')
In theory, all you need to do to delete an IndexedDB in Chrome is:
In Chrome, go to Options > Under the Hood > Content Settings > All cookies and Site Data > find the domain where you created the IndexedDB
Hit either the "X" or click "Indexed Database" > Remove
In Windows, the file is located here:
%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\IndexedDB
On Mac, do the following:
In Chrome, go to "Settings" (or "Preferences" under the Chrome menu)
Click "show advanced settings" (at the bottom of the page)
Go to "Privacy" > "Content Settings" > "All cookies and Site Data" > find the domain where you created the IndexedDB
Hit either the "X" or click "Indexed Database" > Remove
On Mac, the folder is located here:
/Users/[USERNAME]/Library/Application Support/Google/Chrome/Default/IndexedDB/
On Linux, the folder is located at:
/home/[USERNAME]/.config/google-chrome/Default/IndexedDB/
Alternarive is to do it in the developers console, using this command:
indexedDB.deleteDatabase("databaseName")
In Chrome webkit you can use webkitGetDatabaseNames which returns all database names
With this code, you can delete all local indexedDB:
window.indexedDB.webkitGetDatabaseNames().onsuccess = function(sender,args)
{
var r = sender.target.result;
for(var i in r)
indexedDB.deleteDatabase(r[i]);
};
To remove all Chrome IndexedDB databases run the following in OSX terminal emulator.
rm -rf ${HOME}/Library/Application\ Support/Google/Chrome/Default/IndexedDB/*
Now restart your browser and that's it.
Because I need to purge IndexedDB databases very often, I have set up an alias in my ~./bash_profile.
alias purge-idb="rm -rf ${HOME}/Library/Application\ Support/Google/Chrome/Default/IndexedDB/*"
Chrome -> Inspector Window -> Application -> look at left hand menu -> Storage -> IndexedDB
You have to be on your application's page though. Also I think Safari expires IDB data after 7 days or something.
write this code segment in console
window.indexedDB.deleteDatabase(<your db name>)
To delete an IndexedDB from the OS X version of Chrome:
1) In Preferences, show Advanced Settings then click the "Content Settings" button under the "Privacy" section.
2) In the "Content Settings" popup, click the "All Cookies and Site Data" button under the "Cookies" section.
3) In the "Cookies and site data" popup, use the "Search Cookies" textbox to look up the domain that is the source of the IndexedDB.
4) Click on the domain entry in the list.
5) Click on the "indexed database" tag listed under the domain.
6) Click on the "Remove" button in the drop down detail for the indexed database.
Chrome Developer tools now have an option to delete all databases for an app, under "Application/Clear Storage".
In Debian GNU/Linux directory
/home/[username]/.config/google-chrome/Default/IndexedDB/chrome-xxx.indexeddb.leveldb/
contains regular files (for example):
000003.log, CURRENT, LOCK, LOG, MANIFEST-000002
It's not possible to delete IndexedDB database (as opposed to stores and indexes) programmatically.
As for manual workarounds, this post details the location of the database on Windows systems for Firefox and Chrome.
Update: Thanks to developer Joshua Bell, Chrome implements an off-spec (but insanely useful) deleteDatabase method on the window.indexedDB object. Here's the crbug that landed this patch. Moreover, in newer versions of IE, you can delete databases via a settings panel.
This is maybe overkill for your specific question, but I kept ending up here in my struggle to delete my idb.
My solution in the end was based on mozilla's documentation, but required that I first close the database.
For me, in Javascript, the code looked like this:
my_db_instance.close(function(e){console.log(e)});
var DBDeleteRequest = indexedDB.deleteDatabase("my_db_name");
// When i had the base open, the closure was blocked, so i left this here
DBDeleteRequest.onblocked = function(event) {
console.log("Blocked");
};
DBDeleteRequest.onerror = function(event) {
console.log("Error deleting database.");
console.log(event);
};
DBDeleteRequest.onsuccess = function(event) {
console.log("Database deleted successfully");
};
In order to complete #Judson's answer, based on #fullstacklife's comment; for deleting IndexedDB in chrome using javascript you should:
let currentIDB = indexedDB.open("DB_NAME", DB_VERSION_INTEGER);
currentIDB.onblocked = function(){
//
};
currentIDB.onerror = function(){
//
};
currentIDB.onsuccess = function(){
var idb = currentIDB.result;
idb.close();
indexedDB.deleteDatabase("DB_NAME");
};
To delete IndexedDB in Chrome on Android:
Settings
Site settings
Data stored
Search needed site and press
Delete stored data
(You cannot delete IndexedDB via Settings -> Privacy and security section, what is quite misleading...)
Alternatively, use your web application in a new incognito window, and close it when you're done: database deleted.
In chrome OSX- /Users/user/Library/Application Support/Google/Chrome/Default/IndexedDB
Firefox OSX - Users/user/Library/Application Support/Firefox/Profiles/4zaemxcn.default/indexedDB
You just need to make visible the library folder. All of the files are stored in folders(which are called as domain name) and the files use hash, but you can figure out the name of database from it.
You can delete data from IDB because it is a client side database and all of the data is stored locally.
In windows, you can manually delete the whole IndexedDB databases by locating the IndexedDB directory for the browser and deleting it
For Chrome:
C:\Users\user-name\AppData\Local\Google\Chrome\User Data\Profile 1\IndexedDB
You can delete every folder which clears up the indexedDB. You can start over now.
I needed to get rid of an indexedDB in Chrome. So I search for this lousy thing called "email assistant" on my computer using MasterSeeker. Found the thing in a bunch folders that were indexedDB in Chrome. It seemed too easy that I just delete those files. I looked up how, and ended up here. I went to chrome settings with my Windows 10 PC. I just gave it a shot at trying to clear the browsing data. Presto - all those files disappeared from indexedDB, including that dreaded "email assistant" crapola. Now when I look in the indexedDB folder all I see that has reappeared is https_mail.google.com_0.indexeddb.leveldb - which looks like a safe non-irritating thing.
//By for loop
const deleteAllDBs=async()=>{
const existingDBs=await indexedDB.databases()
for (let i = 0; i < existingDBs.length; i++) {
indexedDB.deleteDatabase(existingDBs[i].name)
}
}
//By forEach loop
const dbs = await window.indexedDB.databases()
dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) })
Since most of the answers not mentioned how to find the db names:
Open the site you want db to be cleared.
Press F12 in Chrome, select console regime.
Type indexedDB.databases().then(res => console.log(res)) to learn database names used by this website (open the result with interactive console, find the name).
Finally, as mentioned above, execute in the console indexedDB.deleteDatabase('<your database name>').