mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +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
|
@ -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) });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue