1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
declare type voidCallback = () => void;
declare type stringCallback = (arg0: string) => void;
declare type objectCallback<T> = (arg0: T) => void;
declare type booleanCallback = (arg0: boolean) => void;
declare interface JsonT {
/**
* loads JSON from file sync.
* @param {string} path path to load from.
* @param {boolean} hasComments file to load has comments in json.
* @return {T}
*/
loadS: <T = any>(path: string, hasComments?: boolean) => T;
/**
* saves JSON data to file sync.
* @param {string} path path to save to.
* @param {T} data data to save.
* @return {void}
*/
saveS: <T = any>(path: string, data: T) => void;
/**
* loads JSON from file.
* @param {string} path path to load from.
* @param {objectCallback<T>} callback callback to call.
* @param {boolean} hasComments file to load has comments in json.
* @return {Promise<T>}
*/
load: <T = any>(path: string, callback?: objectCallback<T> | undefined, hasComments?: boolean) => Promise<T>;
/**
* saves JSON data to file.
* @param {string} path path to save to.
* @param {T} data data to save.
* @param {voidCallback} callback callback to call.
* @return {Promise<void>}
*/
save: <T = any>(path: string, data: T, callback?: voidCallback | undefined) => Promise<void>;
/**
* loads JSON from file.
* @param {string} path path to load from.
* @param {objectCallback<T>} callback callback to call.
* @param {boolean} hasComments file to load has comments in json.
*/
loadW: <T = any>(path: string, callback?: objectCallback<T> | undefined, hasComments?: boolean) => Promise<T>;
/**
* saves JSON data to file.
* @param {string} path path to save to.
* @param {T} data data to save.
* @param {voidCallback} callback callback to call.
*/
saveW: <T = any>(path: string, data: T, callback?: voidCallback | undefined) => Promise<void>;
}
declare interface StringSave {
/**
* saves string to file sync.
* @param {string} path path to save to.
* @return {void}
*/
saveS: (path: string) => void;
/**
* saves string to file async.
* @param {string} path path to save to.
* @param {voidCallback} callback callback to call.
* @return {Promise<void>}
*/
save: (path: string, callback?: voidCallback | undefined) => Promise<void>;
/**
* saves string to file with worker.
* @param {string} path path to save to.
* @param {voidCallback} callback callback to call.
*/
saveW: (path: string, callback?: voidCallback | undefined) => Promise<void>;
}
declare interface FileT {
/**
* loads string data from file sync.
* @param {string} path path to load from.
* @return {string}
*/
loadS: (path: string) => string;
/**
* loads string data from file async.
* @param {string} path path to load from.
* @param {stringCallback} callback callback to call.
* @return {Promise<string>}
*/
load: (path: string, callback?: stringCallback | undefined) => Promise<string>;
/**
* loads string data from file with worker.
* @param {string} path path to load from.
* @param {stringCallback} callback callback to call.
*/
loadW: (path: string, callback?: stringCallback | undefined) => Promise<string>;
/**
* saves string to file sync.
* @param {string} path path to save to.
* @param {string} data data to save.
* @return {void}
*/
saveS: (path: string, data: string) => void;
/**
* saves string to file async.
* @param {string} path path to save to.
* @param {string} data data to save.
* @param {voidCallback} callback callback to call.
* @return {Promise<void>}
*/
save: (path: string, data: string, callback?: voidCallback | undefined) => Promise<void>;
/**
* saves string to file with worker.
* @param {string} path path to save to.
* @param {string} data data to save.
* @param {voidCallback} callback callback to call.
*/
saveW: (path: string, data: string, callback?: voidCallback | undefined) => Promise<void>;
}
declare interface DirT {
/**
* Creates directory on filesystem synchronous.
* @param {string} path path to dir
* @return {void}
*/
mkS: (path: string) => void;
/**
* Removes directory on filesystem synchronous.
* @param {string} path path to dir
* @return {void}
*/
rmS: (path: string) => void;
/**
* Checks if directory exists on filesystem synchronous.
* @param {string} path path to dir.
* @return {boolean}
*/
checkS: (path: string) => boolean;
/**
* Creates directory on filesystem asynchronous.
* @param {string} path path to dir
* @param {voidCallback} callback callback to call.
* @return {Promise<void>}
*/
mk: (path: string, callback?: voidCallback | undefined) => Promise<void>;
/**
* Removes directory on filesystem asynchronous.
* @param {string} path path to dir
* @param {voidCallback} callback callback to call.
* @return {Promise<void>}
*/
rm: (path: string, callback?: voidCallback | undefined) => Promise<void>;
/**
* Checks if directory exists on filesystem asynchronous.
* @param {string} path path to dir.
* @param {booleanCallback} callback callback to call.
* @return {Promise<boolean>}
*/
check: (path: string, callback?: booleanCallback | undefined) => Promise<boolean>;
/**
* NodeModules finds where the node_modules directories are.
* @param {{ cwd?: string; relative?: boolean; } | string} input optional cwd input.
* @returns an array of locations where node_modules is found.
*/
nodeModules: (input?: { cwd?: string; relative?: boolean; } | string) => string[];
}
declare interface BufT {
/**
* loads buffer data from file.
* @param {string} path path to load from.
* @param {objectCallback<Buffer>} callback callback to call.
* @return {Promise<Buffer>}
*/
load: (path: string, callback?: objectCallback<Buffer> | undefined) => Promise<Buffer>;
/**
* saves buffer to file.
* @param {string} path path to save to.
* @param {Buffer} data data to save.
* @param {voidCallback} callback callback to call.
* @return {Promise<void>}
*/
save: (path: string, data: Buffer, callback?: voidCallback | undefined) => Promise<void>;
/**
* loads buffer data from file.
* @param {string} path path to load from.
* @param {objectCallback<Buffer>} callback callback to call.
*/
loadW: (path: string, callback?: objectCallback<Buffer> | undefined) => Promise<Buffer>;
/**
* saves buffer to file.
* @param {string} path path to save to.
* @param {Buffer} data data to save.
* @param {voidCallback} callback callback to call.
*/
saveW: (path: string, data: Buffer, callback?: voidCallback | undefined) => Promise<void>;
}
export {
FileT,
JsonT,
StringSave,
BufT,
DirT,
};
|