The system.storage permission allows an extension to query for information about the system's storage devices and be notified when devices are attached and detached.
What it does
- Grants access to the
chrome.system.storageAPI. - Allows an extension to get a list of available storage devices (e.g., hard drives, USB drives).
- For each device, it can provide information like:
- Device ID.
- Name.
- Type (e.g., "fixed", "removable").
- Total capacity in bytes.
- It provides events for when removable storage devices are attached or detached.
When to use it
This is for extensions that interact with storage devices, especially removable ones. It is often used in conjunction with file system APIs on ChromeOS.
Examples:
- A "USB manager" extension that shows information about a connected USB drive.
- An extension for a kiosk that needs to save data to a specific removable device.
- A file-syncing application that needs to detect when its target drive is connected.
Manifest Declaration
{
"name": "My Storage Manager",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"system.storage"
]
}Security & Privacy
Why is it not very risky?
This permission lets an extension see information about your storage devices, like your computer's hard drive or a connected USB drive. It can see the drive's name, type, and total size.
This is a low-risk permission because it cannot read or write any files on those drives. It can only see that the drives exist. The only minor risk is that this information could be used by websites to help identify your specific computer (a technique called "fingerprinting"), but for most users, this is not a significant concern.
API Usage Example
This example gets a list of all storage devices and listens for new ones being attached.
// background.js
async function getStorageInfo() {
if (!chrome.system.storage) {
console.log('System Storage API not available.');
return;
}
try {
const storageUnits = await chrome.system.storage.getInfo();
console.log(`Found ${storageUnits.length} storage unit(s):`);
storageUnits.forEach(unit => {
console.log(` - Name: ${unit.name}, Type: ${unit.type}, Capacity: ${(unit.capacity / 1e9).toFixed(2)} GB`);
});
} catch (error) {
console.error('Error getting storage info:', error);
}
}
// Listen for a new device being plugged in
chrome.system.storage.onAttached.addListener((info) => {
console.log(`Storage device attached: ${info.name}`);
getStorageInfo(); // Refresh the list
});
// Listen for a device being unplugged
chrome.system.storage.onDetached.addListener((id) => {
console.log(`Storage device with ID ${id} was detached.`);
getStorageInfo(); // Refresh the list
});
getStorageInfo();Extensions with the system.storage permission
Here are some popular browser extensions that use the "system.storage" permission. To explore more, try our Advanced search.