From acf0958e940f8c668c9f34dc780da48d8963a1e7 Mon Sep 17 00:00:00 2001 From: dubiousjim Date: Fri, 6 Mar 2020 11:29:23 -0500 Subject: Rename name/filename arguments to path (#4227) There's a lot of variation in doc comments and internal code about whether the first parameter to file system calls is `path` or `name` or `filename`. For consistency, have made it always be `path`. --- cli/js/stat.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'cli/js/stat.ts') diff --git a/cli/js/stat.ts b/cli/js/stat.ts index ea4ab1014..fa49953fb 100644 --- a/cli/js/stat.ts +++ b/cli/js/stat.ts @@ -23,61 +23,61 @@ export interface StatResponse { blocks: number; } -/** Resolves to a `Deno.FileInfo` for the specified path. If path is a +/** Resolves to a `Deno.FileInfo` for the specified `path`. If `path` is a * symlink, information for the symlink will be returned. * * const fileInfo = await Deno.lstat("hello.txt"); * assert(fileInfo.isFile()); * * Requires `allow-read` permission. */ -export async function lstat(filename: string): Promise { +export async function lstat(path: string): Promise { const res = (await sendAsync("op_stat", { - filename, + path, lstat: true })) as StatResponse; return new FileInfoImpl(res); } -/** Synchronously returns a `Deno.FileInfo` for the specified path. If - * path is a symlink, information for the symlink will be returned. +/** Synchronously returns a `Deno.FileInfo` for the specified `path`. If + * `path` is a symlink, information for the symlink will be returned. * * const fileInfo = Deno.lstatSync("hello.txt"); * assert(fileInfo.isFile()); * * Requires `allow-read` permission. */ -export function lstatSync(filename: string): FileInfo { +export function lstatSync(path: string): FileInfo { const res = sendSync("op_stat", { - filename, + path, lstat: true }) as StatResponse; return new FileInfoImpl(res); } -/** Resolves to a `Deno.FileInfo` for the specified path. Will always follow - * symlinks. +/** Resolves to a `Deno.FileInfo` for the specified `path`. Will always + * follow symlinks. * * const fileInfo = await Deno.stat("hello.txt"); * assert(fileInfo.isFile()); * * Requires `allow-read` permission. */ -export async function stat(filename: string): Promise { +export async function stat(path: string): Promise { const res = (await sendAsync("op_stat", { - filename, + path, lstat: false })) as StatResponse; return new FileInfoImpl(res); } -/** Synchronously returns a `Deno.FileInfo` for the specified path. Will +/** Synchronously returns a `Deno.FileInfo` for the specified `path`. Will * always follow symlinks. * * const fileInfo = Deno.statSync("hello.txt"); * assert(fileInfo.isFile()); * * Requires `allow-read` permission. */ -export function statSync(filename: string): FileInfo { +export function statSync(path: string): FileInfo { const res = sendSync("op_stat", { - filename, + path, lstat: false }) as StatResponse; return new FileInfoImpl(res); -- cgit v1.2.3