diff options
author | dubiousjim <dubiousjim@gmail.com> | 2020-03-06 11:29:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 11:29:23 -0500 |
commit | acf0958e940f8c668c9f34dc780da48d8963a1e7 (patch) | |
tree | 69816ce683e0b369e2c7b6566cc249255a39953d /cli/js/write_file.ts | |
parent | bb3d9c8280912f6e30692477aeb5331fb359d993 (diff) |
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`.
Diffstat (limited to 'cli/js/write_file.ts')
-rw-r--r-- | cli/js/write_file.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cli/js/write_file.ts b/cli/js/write_file.ts index 445e4550d..3986eed78 100644 --- a/cli/js/write_file.ts +++ b/cli/js/write_file.ts @@ -26,7 +26,7 @@ export interface WriteFileOptions { * Requires `allow-write` permission, and `allow-read` if create is `false`. */ export function writeFileSync( - filename: string, + path: string, data: Uint8Array, options: WriteFileOptions = {} ): void { @@ -34,15 +34,15 @@ export function writeFileSync( const create = !!options.create; if (!create) { // verify that file exists - statSync(filename); + statSync(path); } } const openMode = !!options.append ? "a" : "w"; - const file = openSync(filename, openMode); + const file = openSync(path, openMode); if (options.perm !== undefined && options.perm !== null) { - chmodSync(filename, options.perm); + chmodSync(path, options.perm); } writeAllSync(file, data); @@ -59,7 +59,7 @@ export function writeFileSync( * Requires `allow-write` permission, and `allow-read` if create is `false`. */ export async function writeFile( - filename: string, + path: string, data: Uint8Array, options: WriteFileOptions = {} ): Promise<void> { @@ -67,15 +67,15 @@ export async function writeFile( const create = !!options.create; if (!create) { // verify that file exists - await stat(filename); + await stat(path); } } const openMode = !!options.append ? "a" : "w"; - const file = await open(filename, openMode); + const file = await open(path, openMode); if (options.perm !== undefined && options.perm !== null) { - await chmod(filename, options.perm); + await chmod(path, options.perm); } await writeAll(file, data); |