Skip to content

Commit

Permalink
Add watch and FSWatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Apr 24, 2024
1 parent d31f06a commit af0cb90
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ console.log(await readFile("my/file"));
// -> My file content
```

Methods:

| Method | Deno | Node | Bun | Base implementation |
| ---------- | ---- | ---- | --- | ------------------- |
| appendFile | X | X | X | node:fs/promises |
Expand All @@ -87,6 +89,8 @@ console.log(await dirpath("config"));
// -> /home/user/.config
```

Methods:

| Method | Deno | Node | Bun | Base implementation |
| --------- | ---- | ---- | --- | ------------------- |
| unlink | X | X | X | node:fs/promises |
Expand All @@ -112,3 +116,9 @@ console.log(await dirpath("config"));
| open | X | X | X | node:fs/promises |
| access | X | X | X | node:fs/promises |
| constants | X | X | X | node:fs/promises |

Types:

| Method | Deno | Node | Bun | Base implementation |
| --------- | ---- | ---- | --- | ------------------- |
| FSWatcher | X | X | X | node:fs/promises |
8 changes: 4 additions & 4 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cross/fs",
"version": "0.0.9",
"version": "0.0.10",
"exports": {
".": "./mod.ts",
"./stat": "./src/stat/mod.ts",
Expand All @@ -12,9 +12,9 @@
"@cross/env": "jsr:@cross/env@^1.0.0",
"@cross/runtime": "jsr:@cross/runtime@^1.0.0",
"@cross/test": "jsr:@cross/test@^0.0.9",
"@cross/utils": "jsr:@cross/utils@^0.10.0",
"@std/assert": "jsr:@std/assert@^0.221.0",
"@std/path": "jsr:@std/path@^0.221.0"
"@cross/utils": "jsr:@cross/utils@^0.11.0",
"@std/assert": "jsr:@std/assert@^0.223.0",
"@std/path": "jsr:@std/path@^0.223.0"
},
"publish": {
"exclude": [".github", "*.test.ts"]
Expand Down
3 changes: 3 additions & 0 deletions src/ops/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ export {
rmdir,
truncate,
unlink,
watch,
} from "node:fs/promises";

export type { FSWatcher } from "node:fs";

export * from "./mktempdir.ts";
export * from "./tempfile.ts";
export * from "./chdir.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/stat/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readdir } from "node:fs/promises";
import { stat } from "./mod.ts";
import type { StatResult } from "./mod.ts";
import { isAbsolute, join, resolve } from "@std/path";
import { cwd } from "@cross/utils/cwd";
import { cwd } from "../ops/cwd.ts";

/**
* Recursively finds files and directories within a specified path, optionally applying advanced filtering.
Expand Down

0 comments on commit af0cb90

Please sign in to comment.