mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 13:14:48 +00:00
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:
parent
bb3d9c8280
commit
acf0958e94
10 changed files with 111 additions and 114 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue