Handling USB Storages

This topic describes how to handle file storages in the Samsung TV file system.

Related Info


You can retrieve information about file storages, including listing available storages and receiving storage change notifications, using the Filesystem API.

For information on how to access and manage the files in the storages, see Managing File Operations.


To use the Filesystem API, the application has to request permission by adding the following privileges to the "config.xml" file:

<tizen:privilege name='http://tizen.org/privilege/filesystem.read'></tizen:privilege> 
<tizen:privilege name='http://tizen.org/privilege/filesystem.write'></tizen:privilege> 

Managing File Storages

To manage file storages:

  • To list the available storages, use the listStorages()method:

    tizen.filesystem.listStorages(function(result) {
    }, function() {

    Removable storages have the prefix "removable_". For example, if 2 USB storages are mounted:

        "label": "removable_sda1",
        "type": "EXTERNAL",
        "state": "MOUNTED"
      }, {
        "label": "removable_sdb1",
        "type": "EXTERNAL",
        "state": "MOUNTED"

    You can simulate adding and removing USB storages in the emulator.

  • To access the files and directories in the storage, retrieve the file handle using the resolve() method with the storage label as a parameter:

    var removable_sda1_obj;
      function(obj) {
        removable_sda1_obj = obj;
      function(error) {

Monitoring Storage State Changes

To receive notifications on storage state changes, for example, additions and removals, register an event handler with the addStorageStateChangeListener() method within the onload attribute:

  tizen.filesystem.addStorageStateChangeListener(function(result) {
  }, function(error) {