feat: read file

This commit is contained in:
karishmas6
2024-06-08 20:55:58 +05:30
parent 7e1e8f2920
commit 595ddb6689

View File

@@ -0,0 +1,19 @@
/**
* A group of functions for storing recordings on the file system.
* Functions are asynchronous to unload the server from heavy file system operations.
*/
import fs from 'fs';
import * as path from "path";
export const readFile = (path: string): Promise<string> => {
return new Promise((resolve, reject) => {
fs.readFile(path, 'utf8', (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
};