mirror of
https://github.com/denoland/deno.git
synced 2025-09-24 03:12:29 +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
56
cli/js/lib.deno.ns.d.ts
vendored
56
cli/js/lib.deno.ns.d.ts
vendored
|
@ -435,7 +435,7 @@ declare namespace Deno {
|
|||
*
|
||||
* Requires `allow-read` and `allow-write` permissions depending on mode.
|
||||
*/
|
||||
export function openSync(filename: string, options?: OpenOptions): File;
|
||||
export function openSync(path: string, options?: OpenOptions): File;
|
||||
|
||||
/** Synchronously open a file and return an instance of the `File` object.
|
||||
*
|
||||
|
@ -443,7 +443,7 @@ declare namespace Deno {
|
|||
*
|
||||
* Requires `allow-read` and `allow-write` permissions depending on mode.
|
||||
*/
|
||||
export function openSync(filename: string, mode?: OpenMode): File;
|
||||
export function openSync(path: string, mode?: OpenMode): File;
|
||||
|
||||
/** Open a file and resolve to an instance of the `File` object.
|
||||
*
|
||||
|
@ -451,7 +451,7 @@ declare namespace Deno {
|
|||
*
|
||||
* Requires `allow-read` and `allow-write` permissions depending on mode.
|
||||
*/
|
||||
export function open(filename: string, options?: OpenOptions): Promise<File>;
|
||||
export function open(path: string, options?: OpenOptions): Promise<File>;
|
||||
|
||||
/** Open a file and resolves to an instance of `Deno.File`.
|
||||
*
|
||||
|
@ -459,7 +459,7 @@ declare namespace Deno {
|
|||
*
|
||||
* Requires `allow-read` and `allow-write` permissions depending on mode.
|
||||
*/
|
||||
export function open(filename: string, mode?: OpenMode): Promise<File>;
|
||||
export function open(path: string, mode?: OpenMode): Promise<File>;
|
||||
|
||||
/** Creates a file if none exists or truncates an existing file and returns
|
||||
* an instance of `Deno.File`.
|
||||
|
@ -468,7 +468,7 @@ declare namespace Deno {
|
|||
*
|
||||
* Requires `allow-read` and `allow-write` permissions.
|
||||
*/
|
||||
export function createSync(filename: string): File;
|
||||
export function createSync(path: string): File;
|
||||
|
||||
/** Creates a file if none exists or truncates an existing file and resolves to
|
||||
* an instance of `Deno.File`.
|
||||
|
@ -477,7 +477,7 @@ declare namespace Deno {
|
|||
*
|
||||
* Requires `allow-read` and `allow-write` permissions.
|
||||
*/
|
||||
export function create(filename: string): Promise<File>;
|
||||
export function create(path: string): Promise<File>;
|
||||
|
||||
/** Synchronously read from a file ID into an array buffer.
|
||||
*
|
||||
|
@ -893,14 +893,14 @@ declare namespace Deno {
|
|||
/** **UNSTABLE**: needs investigation into high precision time.
|
||||
*
|
||||
* Synchronously changes the access and modification times of a file system
|
||||
* object referenced by `filename`. Given times are either in seconds (UNIX
|
||||
* epoch time) or as `Date` objects.
|
||||
* object referenced by `path`. Given times are either in seconds (UNIX epoch
|
||||
* time) or as `Date` objects.
|
||||
*
|
||||
* Deno.utimeSync("myfile.txt", 1556495550, new Date());
|
||||
*
|
||||
* Requires `allow-write` permission. */
|
||||
export function utimeSync(
|
||||
filename: string,
|
||||
path: string,
|
||||
atime: number | Date,
|
||||
mtime: number | Date
|
||||
): void;
|
||||
|
@ -908,14 +908,14 @@ declare namespace Deno {
|
|||
/** **UNSTABLE**: needs investigation into high precision time.
|
||||
*
|
||||
* Changes the access and modification times of a file system object
|
||||
* referenced by `filename`. Given times are either in seconds (UNIX epoch
|
||||
* time) or as `Date` objects.
|
||||
* referenced by `path`. Given times are either in seconds (UNIX epoch time)
|
||||
* or as `Date` objects.
|
||||
*
|
||||
* await Deno.utime("myfile.txt", 1556495550, new Date());
|
||||
*
|
||||
* Requires `allow-write` permission. */
|
||||
export function utime(
|
||||
filename: string,
|
||||
path: string,
|
||||
atime: number | Date,
|
||||
mtime: number | Date
|
||||
): Promise<void>;
|
||||
|
@ -976,7 +976,7 @@ declare namespace Deno {
|
|||
* console.log(decoder.decode(data));
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function readFileSync(filename: string): Uint8Array;
|
||||
export function readFileSync(path: string): Uint8Array;
|
||||
|
||||
/** Reads and resolves to the entire contents of a file.
|
||||
*
|
||||
|
@ -985,7 +985,7 @@ declare namespace Deno {
|
|||
* console.log(decoder.decode(data));
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function readFile(filename: string): Promise<Uint8Array>;
|
||||
export function readFile(path: string): Promise<Uint8Array>;
|
||||
|
||||
// @url js/file_info.d.ts
|
||||
|
||||
|
@ -1127,52 +1127,52 @@ declare namespace Deno {
|
|||
* const targetPath = Deno.readlinkSync("symlink/path");
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function readlinkSync(name: string): string;
|
||||
export function readlinkSync(path: string): string;
|
||||
|
||||
/** Resolves to the destination of the named symbolic link.
|
||||
*
|
||||
* const targetPath = await Deno.readlink("symlink/path");
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function readlink(name: string): Promise<string>;
|
||||
export function readlink(path: string): Promise<string>;
|
||||
|
||||
// @url js/stat.d.ts
|
||||
|
||||
/** Resolves to a `Deno.FileInfo` for the specified path. If path is a
|
||||
/** Resolves to a `Deno.FileInfo` for the specified `path`. If `path` is a
|
||||
* symlink, information for the symlink will be returned.
|
||||
*
|
||||
* const fileInfo = await Deno.lstat("hello.txt");
|
||||
* assert(fileInfo.isFile());
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function lstat(filename: string): Promise<FileInfo>;
|
||||
export function lstat(path: string): Promise<FileInfo>;
|
||||
|
||||
/** Synchronously returns a `Deno.FileInfo` for the specified path. If
|
||||
* path is a symlink, information for the symlink will be returned.
|
||||
/** Synchronously returns a `Deno.FileInfo` for the specified `path`. If
|
||||
* `path` is a symlink, information for the symlink will be returned.
|
||||
*
|
||||
* const fileInfo = Deno.lstatSync("hello.txt");
|
||||
* assert(fileInfo.isFile());
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function lstatSync(filename: string): FileInfo;
|
||||
export function lstatSync(path: string): FileInfo;
|
||||
|
||||
/** Resolves to a `Deno.FileInfo` for the specified path. Will always follow
|
||||
* symlinks.
|
||||
/** Resolves to a `Deno.FileInfo` for the specified `path`. Will always
|
||||
* follow symlinks.
|
||||
*
|
||||
* const fileInfo = await Deno.stat("hello.txt");
|
||||
* assert(fileInfo.isFile());
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function stat(filename: string): Promise<FileInfo>;
|
||||
export function stat(path: string): Promise<FileInfo>;
|
||||
|
||||
/** Synchronously returns a `Deno.FileInfo` for the specified path. Will
|
||||
/** Synchronously returns a `Deno.FileInfo` for the specified `path`. Will
|
||||
* always follow symlinks.
|
||||
*
|
||||
* const fileInfo = Deno.statSync("hello.txt");
|
||||
* assert(fileInfo.isFile());
|
||||
*
|
||||
* Requires `allow-read` permission. */
|
||||
export function statSync(filename: string): FileInfo;
|
||||
export function statSync(path: string): FileInfo;
|
||||
|
||||
// @url js/link.d.ts
|
||||
|
||||
|
@ -1246,7 +1246,7 @@ declare namespace Deno {
|
|||
* Requires `allow-write` permission, and `allow-read` if create is `false`.
|
||||
*/
|
||||
export function writeFileSync(
|
||||
filename: string,
|
||||
path: string,
|
||||
data: Uint8Array,
|
||||
options?: WriteFileOptions
|
||||
): void;
|
||||
|
@ -1261,7 +1261,7 @@ declare namespace Deno {
|
|||
* Requires `allow-write` permission, and `allow-read` if create is `false`.
|
||||
*/
|
||||
export function writeFile(
|
||||
filename: string,
|
||||
path: string,
|
||||
data: Uint8Array,
|
||||
options?: WriteFileOptions
|
||||
): Promise<void>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue