diff options
Diffstat (limited to 'std')
-rw-r--r-- | std/fs/copy.ts | 4 | ||||
-rw-r--r-- | std/fs/empty_dir.ts | 6 | ||||
-rw-r--r-- | std/fs/walk.ts | 6 | ||||
-rwxr-xr-x | std/http/file_server.ts | 6 | ||||
-rw-r--r-- | std/node/_fs_dir.ts | 4 |
5 files changed, 13 insertions, 13 deletions
diff --git a/std/fs/copy.ts b/std/fs/copy.ts index d19c120f7..b199e9167 100644 --- a/std/fs/copy.ts +++ b/std/fs/copy.ts @@ -157,7 +157,7 @@ async function copyDir( await Deno.utime(dest, srcStatInfo.accessed, srcStatInfo.modified); } - const files = await Deno.readDir(src); + const files = await Deno.readdir(src); for (const file of files) { assert(file.name != null, "file.name must be set"); @@ -188,7 +188,7 @@ function copyDirSync(src: string, dest: string, options: CopyOptions): void { Deno.utimeSync(dest, srcStatInfo.accessed, srcStatInfo.modified); } - const files = Deno.readDirSync(src); + const files = Deno.readdirSync(src); for (const file of files) { assert(file.name != null, "file.name must be set"); diff --git a/std/fs/empty_dir.ts b/std/fs/empty_dir.ts index a848e90a1..78b7a42f4 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. @@ -10,7 +10,7 @@ const { readDir, readDirSync, mkdir, mkdirSync, remove, removeSync } = Deno; */ export async function emptyDir(dir: string): Promise<void> { try { - const items = await readDir(dir); + const items = await readdir(dir); while (items.length) { const item = items.shift(); @@ -38,7 +38,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 890114525..fbd14740b 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 { join } from "../path/mod.ts"; -const { readDir, readDirSync, stat, statSync } = Deno; +const { readdir, readdirSync, stat, statSync } = Deno; type FileInfo = Deno.FileInfo; export interface WalkOptions { @@ -79,7 +79,7 @@ export async function* walk( if (maxDepth < 1 || !include(root, undefined, undefined, skip)) { return; } - const ls: FileInfo[] = await readDir(root); + const ls: FileInfo[] = await readdir(root); for (const info of ls) { if (info.isSymlink()) { if (followSymlinks) { @@ -133,7 +133,7 @@ export function* walkSync( if (maxDepth < 1 || !include(root, undefined, undefined, skip)) { return; } - const ls: FileInfo[] = readDirSync(root); + const ls: FileInfo[] = readdirSync(root); for (const info of ls) { if (info.isSymlink()) { if (followSymlinks) { diff --git a/std/http/file_server.ts b/std/http/file_server.ts index e1fe14fcf..28eaef44d 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 } from "../path/mod.ts"; import { listenAndServe, ServerRequest, Response } from "./server.ts"; import { parse } from "../flags/mod.ts"; @@ -113,14 +113,14 @@ async function serveFile( return res; } -// 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[] = []; - const fileInfos = await readDir(dirPath); + const fileInfos = await readdir(dirPath); for (const fileInfo of fileInfos) { const filePath = posix.join(dirPath, fileInfo.name ?? ""); const fileUrl = posix.join(dirUrl, fileInfo.name ?? ""); diff --git a/std/node/_fs_dir.ts b/std/node/_fs_dir.ts index 47d0a6511..e3830bb31 100644 --- a/std/node/_fs_dir.ts +++ b/std/node/_fs_dir.ts @@ -29,7 +29,7 @@ export default class Dir { return new Promise(async (resolve, reject) => { try { if (this.initializationOfDirectoryFilesIsRequired()) { - const denoFiles: Deno.FileInfo[] = await Deno.readDir(this.path); + const denoFiles: Deno.FileInfo[] = await Deno.readdir(this.path); this.files = denoFiles.map(file => new Dirent(file)); } const nextFile = this.files.pop(); @@ -55,7 +55,7 @@ export default class Dir { readSync(): Dirent | null { if (this.initializationOfDirectoryFilesIsRequired()) { this.files.push( - ...Deno.readDirSync(this.path).map(file => new Dirent(file)) + ...Deno.readdirSync(this.path).map(file => new Dirent(file)) ); } const dirent: Dirent | undefined = this.files.pop(); |