Improve tests and docs for Deno.rename (#4597)

This commit is contained in:
dubiousjim 2020-04-03 11:00:16 -04:00 committed by GitHub
parent d8f32c7eff
commit ce02167c75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 170 additions and 34 deletions

View file

@ -1284,8 +1284,10 @@ declare namespace Deno {
*
* Deno.renameSync("old/path", "new/path");
*
* Throws error if attempting to rename to a directory which exists and is not
* empty.
* On Unix, this operation does not follow symlinks at either path.
*
* It varies between platforms when the operation throws errors, and if so what
* they are. It's always an error to rename anything to a non-empty directory.
*
* Requires `allow-read` and `allow-write` permissions. */
export function renameSync(oldpath: string, newpath: string): void;
@ -1297,10 +1299,12 @@ declare namespace Deno {
*
* await Deno.rename("old/path", "new/path");
*
* Throws error if attempting to rename to a directory which exists and is not
* empty.
* On Unix, this operation does not follow symlinks at either path.
*
* Requires `allow-read` and `allow-write`. */
* It varies between platforms when the operation throws errors, and if so what
* they are. It's always an error to rename anything to a non-empty directory.
*
* Requires `allow-read` and `allow-write` permission. */
export function rename(oldpath: string, newpath: string): Promise<void>;
/** Synchronously reads and returns the entire contents of a file as an array