mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Util function to append string in file
This commit is contained in:
committed by
Bugra Cuhadaroglu
parent
a38d58506a
commit
2bad7de4e3
@@ -149,6 +149,16 @@ export async function mkdirp(path: string, mode?: number): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function createOrAppendFile(path: string, data: string, options?: any): Promise<boolean> {
|
||||
try {
|
||||
await nfcall(fs.appendFile, path, data, options);
|
||||
} catch (err) {
|
||||
throw new Error(`Not able to append data in file '${path}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function uniqueFilter<T>(keyFn: (t: T) => string): (t: T) => boolean {
|
||||
const seen: { [key: string]: boolean; } = Object.create(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user