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