1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2024-11-10 06:18:06 +01:00
libcproject/lib/filesystem.h

51 lines
951 B
C
Raw Normal View History

2023-01-05 19:28:05 +01:00
#ifndef __FILESYSTEM__
#define __FILESYSTEM__
2023-01-07 19:38:01 +01:00
#include <dirent.h>
#include <errno.h>
2023-01-05 19:28:05 +01:00
#include <fcntl.h>
2023-01-07 19:38:01 +01:00
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "string.h"
2023-01-05 19:28:05 +01:00
/**
* @brief Read the content of a file.
*
* @param path
* @param file_content
* @param file_size
* @return int
* @retval -1 if the file does not exist or if there is an error.
* @retval 0 for success.
* @since v1.0.0
2023-01-05 19:28:05 +01:00
*/
int filesystem_read(char *path, char **file_content, off_t *file_size);
/**
* @brief Write the content to a file.
*
* @param path
* @param file_content
* @param file_size
* @return int
* @retval -1 if there is an error.
* @retval 0 for success.
* @since v1.0.0
2023-01-05 19:28:05 +01:00
*/
int filesystem_write(char *path, char *file_content, off_t file_size);
/**
* @brief Get the mimetype of a file.
*
* @param path
* @return char*
* @since v1.0.0
2023-01-05 19:28:05 +01:00
*/
char *filesystem_get_mimetype(char *path);
#endif