summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-04-29 16:39:37 -0400
committerGitHub <noreply@github.com>2020-04-29 16:39:37 -0400
commitbc792c02674cc22459a3016b271f9c5b70e9d573 (patch)
tree44636cedddd7d55638733db018b04bf18f22e812 /std
parent78e0ae643c8eb9817b3396cf07a263ce9f03fc4c (diff)
make camel case readDir, readLink, realPath (#4995)
Diffstat (limited to 'std')
-rw-r--r--std/fs/copy.ts8
-rw-r--r--std/fs/empty_dir.ts6
-rw-r--r--std/fs/walk.ts6
-rwxr-xr-xstd/http/file_server.ts6
-rw-r--r--std/node/_fs/_fs_dir.ts4
-rw-r--r--std/node/_fs/_fs_readlink.ts2
-rw-r--r--std/node/module.ts2
7 files changed, 17 insertions, 17 deletions
diff --git a/std/fs/copy.ts b/std/fs/copy.ts
index d442e46ae..609a8437b 100644
--- a/std/fs/copy.ts
+++ b/std/fs/copy.ts
@@ -109,7 +109,7 @@ async function copySymLink(
options: CopyOptions
): Promise<void> {
await ensureValidCopy(src, dest, options);
- const originSrcFilePath = await Deno.readlink(src);
+ const originSrcFilePath = await Deno.readLink(src);
const type = getFileInfoType(await Deno.lstat(src));
await Deno.symlink(originSrcFilePath, dest, type);
if (options.preserveTimestamps) {
@@ -127,7 +127,7 @@ function copySymlinkSync(
options: CopyOptions
): void {
ensureValidCopySync(src, dest, options);
- const originSrcFilePath = Deno.readlinkSync(src);
+ const originSrcFilePath = Deno.readLinkSync(src);
const type = getFileInfoType(Deno.lstatSync(src));
Deno.symlinkSync(originSrcFilePath, dest, type);
if (options.preserveTimestamps) {
@@ -157,7 +157,7 @@ async function copyDir(
await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
}
- for await (const entry of Deno.readdir(src)) {
+ for await (const entry of Deno.readDir(src)) {
const srcPath = path.join(src, entry.name);
const destPath = path.join(dest, path.basename(srcPath as string));
if (entry.isSymlink) {
@@ -185,7 +185,7 @@ function copyDirSync(src: string, dest: string, options: CopyOptions): void {
Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
}
- for (const entry of Deno.readdirSync(src)) {
+ for (const entry of Deno.readDirSync(src)) {
assert(entry.name != null, "file.name must be set");
const srcPath = path.join(src, entry.name);
const destPath = path.join(dest, path.basename(srcPath as string));
diff --git a/std/fs/empty_dir.ts b/std/fs/empty_dir.ts
index 5e860c65f..8c3083cee 100644
--- a/std/fs/empty_dir.ts
+++ b/std/fs/empty_dir.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { join } from "../path/mod.ts";
-const { readdir, readdirSync, mkdir, mkdirSync, remove, removeSync } = Deno;
+const { readDir, readDirSync, mkdir, mkdirSync, remove, removeSync } = Deno;
/**
* Ensures that a directory is empty.
* Deletes directory contents if the directory is not empty.
@@ -11,7 +11,7 @@ const { readdir, readdirSync, mkdir, mkdirSync, remove, removeSync } = Deno;
export async function emptyDir(dir: string): Promise<void> {
try {
const items = [];
- for await (const dirEntry of readdir(dir)) {
+ for await (const dirEntry of readDir(dir)) {
items.push(dirEntry);
}
@@ -41,7 +41,7 @@ export async function emptyDir(dir: string): Promise<void> {
*/
export function emptyDirSync(dir: string): void {
try {
- const items = [...readdirSync(dir)];
+ const items = [...readDirSync(dir)];
// if directory already exist. then remove it's child item.
while (items.length) {
diff --git a/std/fs/walk.ts b/std/fs/walk.ts
index a99d35a50..d01f35167 100644
--- a/std/fs/walk.ts
+++ b/std/fs/walk.ts
@@ -3,7 +3,7 @@
// Copyright 2009 The Go Authors. All rights reserved. BSD license.
import { unimplemented, assert } from "../testing/asserts.ts";
import { basename, join, normalize } from "../path/mod.ts";
-const { readdir, readdirSync, stat, statSync } = Deno;
+const { readDir, readDirSync, stat, statSync } = Deno;
export function createWalkEntrySync(path: string): WalkEntry {
path = normalize(path);
@@ -103,7 +103,7 @@ export async function* walk(
if (maxDepth < 1 || !include(root, undefined, undefined, skip)) {
return;
}
- for await (const entry of readdir(root)) {
+ for await (const entry of readDir(root)) {
if (entry.isSymlink) {
if (followSymlinks) {
// TODO(ry) Re-enable followSymlinks.
@@ -156,7 +156,7 @@ export function* walkSync(
if (maxDepth < 1 || !include(root, undefined, undefined, skip)) {
return;
}
- for (const entry of readdirSync(root)) {
+ for (const entry of readDirSync(root)) {
if (entry.isSymlink) {
if (followSymlinks) {
unimplemented();
diff --git a/std/http/file_server.ts b/std/http/file_server.ts
index c225dbef1..d847642d9 100755
--- a/std/http/file_server.ts
+++ b/std/http/file_server.ts
@@ -6,7 +6,7 @@
// TODO Add tests like these:
// https://github.com/indexzero/http-server/blob/master/test/http-server-test.js
-const { args, stat, readdir, open, exit } = Deno;
+const { args, stat, readDir, open, exit } = Deno;
import { posix, extname } from "../path/mod.ts";
import { listenAndServe, ServerRequest, Response } from "./server.ts";
import { parse } from "../flags/mod.ts";
@@ -133,14 +133,14 @@ export async function serveFile(
};
}
-// TODO: simplify this after deno.stat and deno.readdir are fixed
+// TODO: simplify this after deno.stat and deno.readDir are fixed
async function serveDir(
req: ServerRequest,
dirPath: string
): Promise<Response> {
const dirUrl = `/${posix.relative(target, dirPath)}`;
const listEntry: EntryInfo[] = [];
- for await (const entry of readdir(dirPath)) {
+ for await (const entry of readDir(dirPath)) {
const filePath = posix.join(dirPath, entry.name);
const fileUrl = posix.join(dirUrl, entry.name);
if (entry.name === "index.html" && entry.isFile) {
diff --git a/std/node/_fs/_fs_dir.ts b/std/node/_fs/_fs_dir.ts
index 543cf14ee..a39422ce0 100644
--- a/std/node/_fs/_fs_dir.ts
+++ b/std/node/_fs/_fs_dir.ts
@@ -20,7 +20,7 @@ export default class Dir {
read(callback?: Function): Promise<Dirent | null> {
return new Promise((resolve, reject) => {
if (!this.asyncIterator) {
- this.asyncIterator = Deno.readdir(this.path)[Symbol.asyncIterator]();
+ this.asyncIterator = Deno.readDir(this.path)[Symbol.asyncIterator]();
}
assert(this.asyncIterator);
this.asyncIterator
@@ -42,7 +42,7 @@ export default class Dir {
readSync(): Dirent | null {
if (!this.syncIterator) {
- this.syncIterator = Deno.readdirSync(this.path)![Symbol.iterator]();
+ this.syncIterator = Deno.readDirSync(this.path)![Symbol.iterator]();
}
const file: Deno.DirEntry = this.syncIterator.next().value;
diff --git a/std/node/_fs/_fs_readlink.ts b/std/node/_fs/_fs_readlink.ts
index 1fd7e3c14..b32cd9dd3 100644
--- a/std/node/_fs/_fs_readlink.ts
+++ b/std/node/_fs/_fs_readlink.ts
@@ -5,7 +5,7 @@ import {
notImplemented,
} from "../_utils.ts";
-const { readlink: denoReadlink, readlinkSync: denoReadlinkSync } = Deno;
+const { readLink: denoReadlink, readLinkSync: denoReadlinkSync } = Deno;
type ReadlinkCallback = (
err: MaybeEmpty<Error>,
diff --git a/std/node/module.ts b/std/node/module.ts
index 9203764f0..8969e80d9 100644
--- a/std/node/module.ts
+++ b/std/node/module.ts
@@ -758,7 +758,7 @@ function toRealPath(requestPath: string): string {
let fullPath = requestPath;
while (true) {
try {
- fullPath = Deno.readlinkSync(fullPath);
+ fullPath = Deno.readLinkSync(fullPath);
} catch {
break;
}