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

@ -9,8 +9,8 @@ import { readAll, readAllSync } from "./buffer.ts";
* console.log(decoder.decode(data));
*
* Requires `allow-read` permission. */
export function readFileSync(filename: string): Uint8Array {
const file = openSync(filename);
export function readFileSync(path: string): Uint8Array {
const file = openSync(path);
const contents = readAllSync(file);
file.close();
return contents;
@ -23,8 +23,8 @@ export function readFileSync(filename: string): Uint8Array {
* console.log(decoder.decode(data));
*
* Requires `allow-read` permission. */
export async function readFile(filename: string): Promise<Uint8Array> {
const file = await open(filename);
export async function readFile(path: string): Promise<Uint8Array> {
const file = await open(path);
const contents = await readAll(file);
file.close();
return contents;