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

@ -19,8 +19,8 @@ function coerceLen(len?: number): number {
* Deno.truncateSync("hello.txt", 10);
*
* Requires `allow-write` permission. */
export function truncateSync(name: string, len?: number): void {
sendSync("op_truncate", { name, len: coerceLen(len) });
export function truncateSync(path: string, len?: number): void {
sendSync("op_truncate", { path, len: coerceLen(len) });
}
/** Truncates or extends the specified file, to reach the specified `len`.
@ -28,6 +28,6 @@ export function truncateSync(name: string, len?: number): void {
* await Deno.truncate("hello.txt", 10);
*
* Requires `allow-write` permission. */
export async function truncate(name: string, len?: number): Promise<void> {
await sendAsync("op_truncate", { name, len: coerceLen(len) });
export async function truncate(path: string, len?: number): Promise<void> {
await sendAsync("op_truncate", { path, len: coerceLen(len) });
}