The `Media` class facilitates content-type mapping (mapping between content-types and file
extensions), handling static assets and globally configuring how the framework handles output in
different formats.
Using the `Media` class, you can globally configure input and output of different types of
content, i.e.:
{{{
Media::type('csv', 'application/csv', array('encode' => function($data) {
ob_start();
$out = fopen('php://output', 'w');
foreach ($data as $record) {
fputcsv($out, $record);
}
fclose($out);
return ob_get_clean();
}));
}}}
You may then render CSV content from anywhere in your application. For example, in a controller
you may do the following:
{{{
$this->render(array('csv' => Post::find('all')));
}}}