summaryrefslogtreecommitdiff
path: root/src/support/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/file.cpp')
-rw-r--r--src/support/file.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/support/file.cpp b/src/support/file.cpp
index c1d9e6e33..bd6f2d4bd 100644
--- a/src/support/file.cpp
+++ b/src/support/file.cpp
@@ -73,3 +73,15 @@ wasm::Output::Output(const std::string &filename, Flags::BinaryOption binary, Fl
}
return buffer;
}()) {}
+
+void wasm::copy_file(std::string input, std::string output) {
+ std::ifstream src(input, std::ios::binary);
+ std::ofstream dst(output, std::ios::binary);
+ dst << src.rdbuf();
+}
+
+size_t wasm::file_size(std::string filename) {
+ std::ifstream infile(filename, std::ifstream::ate | std::ifstream::binary);
+ return infile.tellg();
+}
+