Files
IoTManager/include/Utils/FileUtils.h

56 lines
1.1 KiB
C
Raw Normal View History

2020-06-20 17:12:59 +03:00
#pragma once
#include <Arduino.h>
2020-06-21 03:43:15 +03:00
#include "FS.h"
#ifdef ESP32
#include "LITTLEFS.h"
#define LittleFS LITTLEFS
#endif
#ifdef ESP8266
#include <LittleFS.h>
#endif
2020-06-22 03:11:02 +03:00
2020-06-21 03:43:15 +03:00
/*
* Инициализация ФС
*/
bool fileSystemInit();
/*
* Удалить файл
*/
2020-06-25 05:09:11 +03:00
void removeFile(const String& filename);
2020-06-21 03:43:15 +03:00
/*
* Открыть файл на позиции
*/
2020-06-25 05:09:11 +03:00
File seekFile(const String& filename, size_t position = 0);
2020-06-20 17:12:59 +03:00
/*
* Чтение строки из файла
* возвращает стоку из файла в которой есть искомое слово found
*/
2020-06-25 05:09:11 +03:00
const String readFileString(const String& filename, const String& to_find);
2020-06-20 17:12:59 +03:00
/*
* Добовление строки в файл
*/
2020-06-25 05:09:11 +03:00
const String addFile(const String& filename, const String& str);
2020-06-20 17:12:59 +03:00
/*
* Запись строки в файл
*/
2020-06-25 05:09:11 +03:00
const String writeFile(const String& filename, const String& str);
2020-06-20 17:12:59 +03:00
/*
* Чтение файла в строку
*/
2020-06-25 05:09:11 +03:00
const String readFile(const String& filename, size_t max_size);
2020-06-20 17:12:59 +03:00
/*
* Размер файла
*/
2020-06-25 05:09:11 +03:00
const String getFileSize(const String& filename);
2020-06-22 14:01:12 +03:00
2020-06-25 05:09:11 +03:00
bool copyFile(const String& src, const String& dst, bool overwrite = true);