summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_chmod.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-02-02 19:05:46 +0800
committerGitHub <noreply@github.com>2021-02-02 12:05:46 +0100
commit6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (patch)
treefd94c013a19fcb38954844085821ec1601c20e18 /std/node/_fs/_fs_chmod.ts
parenta2b5d44f1aa9d64f448a2a3cc2001272e2f60b98 (diff)
chore: remove std directory (#9361)
This removes the std folder from the tree. Various parts of the tests are pretty tightly dependent on std (47 direct imports and 75 indirect imports, not counting the cli tests that use them as fixtures) so I've added std as a submodule for now.
Diffstat (limited to 'std/node/_fs/_fs_chmod.ts')
-rw-r--r--std/node/_fs/_fs_chmod.ts40
1 files changed, 0 insertions, 40 deletions
diff --git a/std/node/_fs/_fs_chmod.ts b/std/node/_fs/_fs_chmod.ts
deleted file mode 100644
index bf4031d2c..000000000
--- a/std/node/_fs/_fs_chmod.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-import type { CallbackWithError } from "./_fs_common.ts";
-import { fromFileUrl } from "../path.ts";
-
-const allowedModes = /^[0-7]{3}/;
-
-/**
- * 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 chmod(
- path: string | URL,
- mode: string | number,
- callback: CallbackWithError,
-): void {
- path = path instanceof URL ? fromFileUrl(path) : path;
-
- Deno.chmod(path, getResolvedMode(mode)).then(() => callback(null), callback);
-}
-
-/**
- * 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 chmodSync(path: string | URL, mode: string | number): void {
- path = path instanceof URL ? fromFileUrl(path) : path;
- Deno.chmodSync(path, getResolvedMode(mode));
-}
-
-function getResolvedMode(mode: string | number): number {
- if (typeof mode === "number") {
- return mode;
- }
-
- if (typeof mode === "string" && !allowedModes.test(mode)) {
- throw new Error("Unrecognized mode: " + mode);
- }
-
- return parseInt(mode, 8);
-}