summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_chown.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/node/_fs/_fs_chown.ts')
-rw-r--r--std/node/_fs/_fs_chown.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/std/node/_fs/_fs_chown.ts b/std/node/_fs/_fs_chown.ts
index c6baa4722..cd1973b1f 100644
--- a/std/node/_fs/_fs_chown.ts
+++ b/std/node/_fs/_fs_chown.ts
@@ -1,26 +1,31 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { CallbackWithError } from "./_fs_common.ts";
+import { fromFileUrl } from "../path.ts";
/**
- * TODO: Also accept 'path' parameter as a Node polyfill Buffer or URL type once these
+ * TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these
* are implemented. See https://github.com/denoland/deno/issues/3403
*/
export function chown(
- path: string,
+ path: string | URL,
uid: number,
gid: number,
callback: CallbackWithError
): void {
+ path = path instanceof URL ? fromFileUrl(path) : path;
+
Deno.chown(path, uid, gid)
.then(() => callback())
.catch(callback);
}
/**
- * TODO: Also accept 'path' parameter as a Node polyfill Buffer or URL type once these
+ * TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these
* are implemented. See https://github.com/denoland/deno/issues/3403
*/
-export function chownSync(path: string, uid: number, gid: number): void {
+export function chownSync(path: string | URL, uid: number, gid: number): void {
+ path = path instanceof URL ? fromFileUrl(path) : path;
+
Deno.chownSync(path, uid, gid);
}