Skip to content

Commit

Permalink
doc: API improvements to chown, close, compile and connect (denoland#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cknight authored Mar 23, 2020
1 parent 3e74309 commit a0ba476
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions cli/js/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,12 @@ declare namespace Deno {
whence: SeekMode
): Promise<number>;

/** Close the given resource ID. */
/** Close the given resource ID (rid) which has been previously opened, such
* as via opening or creating a file. Closing a file when you are finished
* with it is important to avoid leaking resources.
*
* Deno.close(4);
*/
export function close(rid: number): void;

/** The Deno abstraction for reading and writing files. */
Expand Down Expand Up @@ -967,25 +972,33 @@ declare namespace Deno {
* Requires `allow-write` permission. */
export function chmod(path: string, mode: number): Promise<void>;

/** Synchronously change owner of a regular file or directory. Linux/Mac OS
* only at the moment.
/** Synchronously change owner of a regular file or directory. This functionality
* is not available on Windows.
*
* Deno.chownSync('myFile.txt', 1000, 1002);
*
* Requires `allow-write` permission.
*
* Throws Error (not implemented) if executed on Windows
*
* @param path path to the file
* @param uid user id of the new owner
* @param gid group id of the new owner
* @param uid user id (UID) of the new owner
* @param gid group id (GID) of the new owner
*/
export function chownSync(path: string, uid: number, gid: number): void;

/** Change owner of a regular file or directory. Linux/Mac OS only at the
* moment.
/** Change owner of a regular file or directory. This functionality
* is not available on Windows.
*
* await Deno.chown('myFile.txt', 1000, 1002);
*
* Requires `allow-write` permission.
*
* Throws Error (not implemented) if executed on Windows
*
* @param path path to the file
* @param uid user id of the new owner
* @param gid group id of the new owner
* @param uid user id (UID) of the new owner
* @param gid group id (GID) of the new owner
*/
export function chown(path: string, uid: number, gid: number): Promise<void>;

Expand Down Expand Up @@ -1709,12 +1722,13 @@ declare namespace Deno {
}

/**
* Connects to the address on the named transport.
* Connects to the hostname (default is "127.0.0.1") and port on the named
* transport (default is "tcp").
*
* Deno.connect({ port: 80 })
* Deno.connect({ hostname: "192.0.2.1", port: 80 })
* Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
* Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" })
* const conn1 = await Deno.connect({ port: 80 })
* const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 })
* const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
* const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" })
*
* Requires `allow-net` permission. */
export function connect(options: ConnectOptions): Promise<Conn>;
Expand Down Expand Up @@ -2291,8 +2305,9 @@ declare namespace Deno {

/** **UNSTABLE**: new API, yet to be vetted.
*
* Takes a root module name, any optionally a record set of sources. Resolves
* with a compiled set of modules. If just a root name is provided, the modules
* Takes a root module name, and optionally a record set of sources. Resolves
* with a compiled set of modules and possibly diagnostics if the compiler
* encountered any issues. If just a root name is provided, the modules
* will be resolved as if the root module had been passed on the command line.
*
* If sources are passed, all modules will be resolved out of this object, where
Expand Down

0 comments on commit a0ba476

Please sign in to comment.