@thi.ng/file-io 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-05-08T18:24:31Z
3
+ - **Last updated**: 2024-06-29T09:28:36Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 189 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
@@ -54,7 +54,7 @@ For Node.js REPL:
54
54
  const fio = await import("@thi.ng/file-io");
55
55
  ```
56
56
 
57
- Package sizes (brotli'd, pre-treeshake): ESM: 2.06 KB
57
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.05 KB
58
58
 
59
59
  ## Dependencies
60
60
 
package/file-chunks.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ILogger } from "@thi.ng/logger";
3
2
  export interface FileChunkOpts {
4
3
  /**
package/files.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readdirSync, statSync } from "node:fs";
1
+ import { readdirSync } from "node:fs";
2
2
  import { sep } from "node:path";
3
3
  import { isDirectory } from "./dir.js";
4
4
  import { __ensurePred } from "./internal/ensure.js";
@@ -26,7 +26,7 @@ function* __dirs(dir, match = "", logger, maxDepth = Infinity, depth = 0) {
26
26
  for (let f of readdirSync(dir).sort()) {
27
27
  const curr = dir + sep + f;
28
28
  try {
29
- if (statSync(curr).isDirectory()) {
29
+ if (isDirectory(curr)) {
30
30
  if (pred(curr)) yield curr;
31
31
  yield* __dirs(curr, match, logger, maxDepth, depth + 1);
32
32
  }
package/hash.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type { TypedArray } from "@thi.ng/api";
4
2
  import type { ILogger } from "@thi.ng/logger";
5
3
  import type { Readable } from "node:stream";
@@ -18,7 +16,7 @@ export declare const fileHash: (path: string, logger?: ILogger, algo?: HashAlgo)
18
16
  * "sha256"). If `logger` is given, the hash will be logged too.
19
17
  *
20
18
  * @remarks
21
- * Also see {@link fileHash} and {@link stringHash}.
19
+ * Also see {@link fileHash} and {@link bufferHash}.
22
20
  *
23
21
  * @param src
24
22
  * @param logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/file-io",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Assorted file I/O utils (with logging support) for NodeJS/Bun",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
12
12
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/file-io#readme",
13
+ "homepage": "https://thi.ng/file-io",
14
14
  "funding": [
15
15
  {
16
16
  "type": "github",
@@ -36,17 +36,17 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.2",
40
- "@thi.ng/checks": "^3.6.4",
41
- "@thi.ng/hex": "^2.3.46",
42
- "@thi.ng/logger": "^3.0.12",
43
- "@thi.ng/random": "^3.8.0"
39
+ "@thi.ng/api": "^8.11.4",
40
+ "@thi.ng/checks": "^3.6.6",
41
+ "@thi.ng/hex": "^2.3.48",
42
+ "@thi.ng/logger": "^3.0.14",
43
+ "@thi.ng/random": "^3.8.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@microsoft/api-extractor": "^7.43.2",
47
- "esbuild": "^0.21.1",
46
+ "@microsoft/api-extractor": "^7.47.0",
47
+ "esbuild": "^0.21.5",
48
48
  "typedoc": "^0.25.13",
49
- "typescript": "^5.4.5"
49
+ "typescript": "^5.5.2"
50
50
  },
51
51
  "keywords": [
52
52
  "async",
@@ -123,5 +123,5 @@
123
123
  "status": "stable",
124
124
  "year": 2022
125
125
  },
126
- "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
126
+ "gitHead": "7b950c112fba0b2e7c450765b15624c3382f1354\n"
127
127
  }
package/text.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ILogger } from "@thi.ng/logger";
3
2
  /**
4
3
  * Reads text from given file `path`, optionally with custom encoding (default:
package/watch.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { type Event, type IClear, type INotify, type IObjectOf, type Listener, type Predicate } from "@thi.ng/api";
3
2
  import type { ILogger } from "@thi.ng/logger";
4
3
  import { type FSWatcher } from "node:fs";
@@ -16,7 +15,15 @@ export interface WatcherOpts {
16
15
  logger: ILogger;
17
16
  }
18
17
  export interface PathWatchOpts {
18
+ /**
19
+ * If enabled (default) and if the path refers to a directory, any file
20
+ * changes within that dir (or any subdir) will trigger an event.
21
+ */
19
22
  recursive: boolean;
23
+ /**
24
+ * File extension filter. If given, events are only triggered for paths
25
+ * matching this filter.
26
+ */
20
27
  ext: string | RegExp | Predicate<string>;
21
28
  }
22
29
  export declare const EVENT_ADDED = "added";
package/write.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { TypedArray } from "@thi.ng/api";
3
2
  import type { ILogger } from "@thi.ng/logger";
4
3
  import { type WriteFileOptions } from "node:fs";