diff options
Diffstat (limited to 'js/make_temp_dir.ts')
-rw-r--r-- | js/make_temp_dir.ts | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/js/make_temp_dir.ts b/js/make_temp_dir.ts index 1ee095bbc..dc04522ee 100644 --- a/js/make_temp_dir.ts +++ b/js/make_temp_dir.ts @@ -10,32 +10,6 @@ export interface MakeTempDirOptions { suffix?: string; } -/** makeTempDirSync is the synchronous version of `makeTempDir`. - * - * const tempDirName0 = Deno.makeTempDirSync(); - * const tempDirName1 = Deno.makeTempDirSync({ prefix: 'my_temp' }); - */ -export function makeTempDirSync(options: MakeTempDirOptions = {}): string { - return res(dispatch.sendSync(...req(options))); -} - -/** makeTempDir creates a new temporary directory in the directory `dir`, its - * name beginning with `prefix` and ending with `suffix`. - * It returns the full path to the newly created directory. - * If `dir` is unspecified, tempDir uses the default directory for temporary - * files. Multiple programs calling tempDir simultaneously will not choose the - * same directory. It is the caller's responsibility to remove the directory - * when no longer needed. - * - * const tempDirName0 = await Deno.makeTempDir(); - * const tempDirName1 = await Deno.makeTempDir({ prefix: 'my_temp' }); - */ -export async function makeTempDir( - options: MakeTempDirOptions = {} -): Promise<string> { - return res(await dispatch.sendAsync(...req(options))); -} - function req({ dir, prefix, @@ -68,3 +42,29 @@ function res(baseRes: null | msg.Base): string { assert(path != null); return path!; } + +/** makeTempDirSync is the synchronous version of `makeTempDir`. + * + * const tempDirName0 = Deno.makeTempDirSync(); + * const tempDirName1 = Deno.makeTempDirSync({ prefix: 'my_temp' }); + */ +export function makeTempDirSync(options: MakeTempDirOptions = {}): string { + return res(dispatch.sendSync(...req(options))); +} + +/** makeTempDir creates a new temporary directory in the directory `dir`, its + * name beginning with `prefix` and ending with `suffix`. + * It returns the full path to the newly created directory. + * If `dir` is unspecified, tempDir uses the default directory for temporary + * files. Multiple programs calling tempDir simultaneously will not choose the + * same directory. It is the caller's responsibility to remove the directory + * when no longer needed. + * + * const tempDirName0 = await Deno.makeTempDir(); + * const tempDirName1 = await Deno.makeTempDir({ prefix: 'my_temp' }); + */ +export async function makeTempDir( + options: MakeTempDirOptions = {} +): Promise<string> { + return res(await dispatch.sendAsync(...req(options))); +} |