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`.
This commit is contained in:
dubiousjim 2020-03-06 11:29:23 -05:00 committed by GitHub
parent bb3d9c8280
commit acf0958e94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 111 additions and 114 deletions

View file

@ -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<FileInfo> {
export async function lstat(path: string): Promise<FileInfo> {
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<FileInfo> {
export async function stat(path: string): Promise<FileInfo> {
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);