## ev-file-helpers ev-file-helpers |

## Synopsis

    enum                EvCompressionType;
    int                 ev_mkstemp                          (const char *tmpl,
                                                             char **file_name,
                                                             GError **error);
    GFile *             ev_mkstemp_file                     (const char *tmpl,
                                                             GError **error);
    gchar *             ev_mkdtemp                          (const char *tmpl,
                                                             GError **error);
    void                ev_tmp_filename_unlink              (const gchar *filename);
    void                ev_tmp_file_unlink                  (GFile *file);
    void                ev_tmp_uri_unlink                   (const gchar *uri);
    gboolean            ev_xfer_uri_simple                  (const char *from,
                                                             const char *to,
                                                             GError **error);
    gboolean            ev_file_copy_metadata               (const char *from,
                                                             const char *to,
                                                             GError **error);
    gchar *             ev_file_get_mime_type               (const gchar *uri,
                                                             gboolean fast,
                                                             GError **error);
    gchar *             ev_file_uncompress                  (const gchar *uri,
                                                             EvCompressionType type,
                                                             GError **error);
    gchar *             ev_file_compress                    (const gchar *uri,
                                                             EvCompressionType type,
                                                             GError **error);
    gboolean            ev_file_is_temp                     (GFile *file);
    const gchar *       ev_get_locale_dir                   (void);

## Object Hierarchy

      GEnum
       +----EvCompressionType

## Description

## Details

### enum EvCompressionType

    typedef enum {
    	EV_COMPRESSION_NONE,
    	EV_COMPRESSION_BZIP2,
    	EV_COMPRESSION_GZIP,
            EV_COMPRESSION_LZMA
    } EvCompressionType;

`EV_COMPRESSION_NONE` |
`EV_COMPRESSION_BZIP2` |
`EV_COMPRESSION_GZIP` |
`EV_COMPRESSION_LZMA` |

### ev_mkstemp ()

    int                 ev_mkstemp                          (const char *tmpl,
                                                             char **file_name,
                                                             GError **error);

### ev_mkstemp_file ()

    GFile *             ev_mkstemp_file                     (const char *tmpl,
                                                             GError **error);

### ev_mkdtemp ()

    gchar *             ev_mkdtemp                          (const char *tmpl,
                                                             GError **error);

### ev_tmp_filename_unlink ()

    void                ev_tmp_filename_unlink              (const gchar *filename);

### ev_tmp_file_unlink ()

    void                ev_tmp_file_unlink                  (GFile *file);

### ev_tmp_uri_unlink ()

    void                ev_tmp_uri_unlink                   (const gchar *uri);

### ev_xfer_uri_simple ()

    gboolean            ev_xfer_uri_simple                  (const char *from,
                                                             const char *to,
                                                             GError **error);

Performs a `g_file_copy()` from `from` to `to`.

`from` : | the source URI
`to` : | the target URI
`error` : | a GError location to store an error, or `NULL`
Returns : | `TRUE` on success, or `FALSE` on error with `error` filled in

### ev_file_copy_metadata ()

    gboolean            ev_file_copy_metadata               (const char *from,
                                                             const char *to,
                                                             GError **error);

Since 3.4

### ev_file_get_mime_type ()

    gchar *             ev_file_get_mime_type               (const gchar *uri,
                                                             gboolean fast,
                                                             GError **error);

`uri` : | the URI
`fast` : | whether to use fast MIME type detection
`error` : | a GError location to store an error, or `NULL`
Returns : | a newly allocated string with the MIME type of the file at `uri`, or `NULL` on error or if the MIME type could not be determined

### ev_file_uncompress ()

    gchar *             ev_file_uncompress                  (const gchar *uri,
                                                             EvCompressionType type,
                                                             GError **error);

Uncompresses the file at `uri`.

If `type` is `EV_COMPRESSION_NONE`, it does nothing and returns `NULL`.

Otherwise, it returns the filename of a temporary file containing the decompressed data from the file at `uri`. On error it returns `NULL` and fills in `error`.

It is the caller's responsibility to unlink the temp file after use.

`uri` : | a file URI
`type` : | the compression type
`error` : | a GError location to store an error, or `NULL`
Returns : | a newly allocated string URI, or `NULL` on error

### ev_file_compress ()

    gchar *             ev_file_compress                    (const gchar *uri,
                                                             EvCompressionType type,
                                                             GError **error);

Compresses the file at `uri`. If `type` is `EV_COMPRESSION_NONE`, it does nothing and returns `NULL`.

Otherwise, it returns the filename of a temporary file containing the compressed data from the file at `uri`.

On error it returns `NULL` and fills in `error`.

It is the caller's responsibility to unlink the temp file after use.

`uri` : | a file URI
`type` : | the compression type
`error` : | a GError location to store an error, or `NULL`
Returns : | a newly allocated string URI, or `NULL` on error

### ev_file_is_temp ()

    gboolean            ev_file_is_temp                     (GFile *file);

### ev_get_locale_dir ()

    const gchar *       ev_get_locale_dir                   (void);