Get all managed file usage by id Is there a way to get all the managed files used by a particular entity, i.e. a node or other module item?

Looking in the file_usage table there is an id column and this is what I want to retrieve fid's by.

Seems like something that there would be a function for, but I haven't found it yet...
I don't think there is such a function. However it's not hard to create your own. Here's an example:

function load_files_by_type($type, $id) {
  // Select all used files by type and id.
  $query = db_select('file_usage', 'fu')
    -&gt;fields('fu', array('fid'))
    -&gt;condition('fu.type', $type)
    -&gt;condition('fu.id', $id);

  // Load all file ids in an array.
  $fids = $query-&gt;execute()-&gt;fetchCol();

  // Return the file objects.
  return file_load_multiple($fids);
}


You can call it like this: load_files_by_type('node', 64);

Of course you can alter the query to your liking, you could even add a module check.