mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
BREAKING CHANGE: rename Deno.fsEvents() to Deno.watchFs() (#4886)
This commit is contained in:
parent
6a37e4426e
commit
824329f0da
5 changed files with 18 additions and 20 deletions
14
cli/js/lib.deno.ns.d.ts
vendored
14
cli/js/lib.deno.ns.d.ts
vendored
|
@ -2169,15 +2169,12 @@ declare namespace Deno {
|
|||
*/
|
||||
export function resources(): ResourceMap;
|
||||
|
||||
/** **UNSTABLE**: new API. Needs docs. */
|
||||
export interface FsEvent {
|
||||
kind: "any" | "access" | "create" | "modify" | "remove";
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
/** **UNSTABLE**: new API, yet to be vetted.
|
||||
*
|
||||
* Watch for file system events against one or more `paths`, which can be files
|
||||
/** Watch for file system events against one or more `paths`, which can be files
|
||||
* or directories. These paths must exist already. One user action (e.g.
|
||||
* `touch test.file`) can generate multiple file system events. Likewise,
|
||||
* one user action can result in multiple file paths in one event (e.g. `mv
|
||||
|
@ -2185,14 +2182,15 @@ declare namespace Deno {
|
|||
* for directories, will watch the specified directory and all sub directories.
|
||||
* Note that the exact ordering of the events can vary between operating systems.
|
||||
*
|
||||
* const iter = Deno.fsEvents("/");
|
||||
* for await (const event of iter) {
|
||||
* console.log(">>>> event", event); // e.g. { kind: "create", paths: [ "/foo.txt" ] }
|
||||
* const watcher = Deno.watchFs("/");
|
||||
* for await (const event of watcher) {
|
||||
* console.log(">>>> event", event);
|
||||
* // { kind: "create", paths: [ "/foo.txt" ] }
|
||||
* }
|
||||
*
|
||||
* Requires `allow-read` permission.
|
||||
*/
|
||||
export function fsEvents(
|
||||
export function watchFs(
|
||||
paths: string | string[],
|
||||
options?: { recursive: boolean }
|
||||
): AsyncIterableIterator<FsEvent>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue