@icoms-detection/server-esp32
Version:
This is the OFFICIAL SERVER library created by Icoms Detection to run their apps.
49 lines (48 loc) • 1.58 kB
TypeScript
import * as http from "http";
export declare const isOnEsp32: boolean;
/**
* Format a string to a correct and ready to use path
* @param pathname path to format
* @returns path
*/
export declare const urlPathnameFormater: (pathname: string) => string;
export declare const getContentType: (path: string) => string;
export declare const addContentType: (contentType: {
[extension: string]: string;
}) => void;
/**
* Give the body of a request
* @param req
* @param res
*/
export declare const getBody: <T>(req: http.IncomingMessage, res: http.ServerResponse) => Promise<T>;
/**
* let you to know if this path point to a folder
* @param absolutePath
* @returns true if it is folder
*/
export declare const isFolder: (absolutePath: string) => boolean;
/**
* Tells you if this path points to a existing file or folder
* @param absolutePath
* @returns true if it exists
*/
export declare const fileExists: (absolutePath: string) => boolean;
/**
* Returns the size of the file in bytes
* @param absolutePath
* @returns number of bytes
*/
export declare const getFileSize: (absolutePath: string) => number;
/**
* Returns a list of the names of all files and folders present in a folder
* @param absolutePath of the folder
* @returns number of bytes
*/
export declare const getFolderSize: (absolutePath: string) => number;
/**
* Give you all files and folder name of each element under this folder
* @param absolutePath of the folder
* @returns array of all files into this folder
*/
export declare const getFilesInFolder: (absolutePath: string) => string[];