mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
Merge deno_cli_snapshots into deno_cli (#3064)
This commit is contained in:
parent
9049213867
commit
b81e5db17a
148 changed files with 38 additions and 83 deletions
24
cli/js/rename.ts
Normal file
24
cli/js/rename.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { sendSync, sendAsync } from "./dispatch_json.ts";
|
||||
import * as dispatch from "./dispatch.ts";
|
||||
|
||||
/** Synchronously renames (moves) `oldpath` to `newpath`. If `newpath` already
|
||||
* exists and is not a directory, `renameSync()` replaces it. OS-specific
|
||||
* restrictions may apply when `oldpath` and `newpath` are in different
|
||||
* directories.
|
||||
*
|
||||
* Deno.renameSync("old/path", "new/path");
|
||||
*/
|
||||
export function renameSync(oldpath: string, newpath: string): void {
|
||||
sendSync(dispatch.OP_RENAME, { oldpath, newpath });
|
||||
}
|
||||
|
||||
/** Renames (moves) `oldpath` to `newpath`. If `newpath` already exists and is
|
||||
* not a directory, `rename()` replaces it. OS-specific restrictions may apply
|
||||
* when `oldpath` and `newpath` are in different directories.
|
||||
*
|
||||
* await Deno.rename("old/path", "new/path");
|
||||
*/
|
||||
export async function rename(oldpath: string, newpath: string): Promise<void> {
|
||||
await sendAsync(dispatch.OP_RENAME, { oldpath, newpath });
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue