blob: 2deb08220179d5f25fc72cfd8046d0704f9319c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include "tgbot/types/InputFile.h"
#include "tgbot/tools/FileTools.h"
#include <filesystem>
#include <memory>
#include <string>
namespace TgBot {
InputFile::Ptr InputFile::fromFile(const std::string& filePath, const std::string& mimeType) {
auto result(std::make_shared<InputFile>());
result->data = FileTools::read(filePath);
result->mimeType = mimeType;
result->fileName = std::filesystem::path(filePath).filename().string();
return result;
}
}
|