@visulima/fs 5.0.0-alpha.1 → 5.0.0-alpha.11
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 +177 -0
- package/LICENSE.md +157 -128
- package/dist/eol.d.ts +6 -35
- package/dist/error.d.ts +43 -7
- package/dist/error.js +1 -1
- package/dist/glob-parent.d.ts +5 -0
- package/dist/glob-parent.js +90 -0
- package/dist/glob.d.ts +5 -0
- package/dist/glob.js +2 -0
- package/dist/index.d.ts +81 -36
- package/dist/index.js +32 -27
- package/dist/ini.d.ts +10 -0
- package/dist/ini.js +4 -0
- package/dist/is-glob.d.ts +5 -0
- package/dist/is-glob.js +9 -0
- package/dist/json5.d.ts +12 -0
- package/dist/json5.js +4 -0
- package/dist/jsonc.d.ts +10 -0
- package/dist/jsonc.js +4 -0
- package/dist/match.d.ts +5 -0
- package/dist/match.js +15 -0
- package/dist/packem_shared/{WalkError-DUdQd6FT.js → WalkError-DER5A43G.js} +1 -1
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
- package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +12 -0
- package/dist/packem_shared/{collect-DcBwsYYd.js → collect-CqQ3eVab.js} +1 -1
- package/dist/packem_shared/{collectSync-Bkjf9Dbm.js → collectSync-noE08NNv.js} +1 -1
- package/dist/packem_shared/{emptyDir-CYB5Tict.js → emptyDir-DnwENOaV.js} +5 -2
- package/dist/packem_shared/{emptyDirSync-BD8-1Ytl.js → emptyDirSync-6WiHBo8a.js} +3 -1
- package/dist/packem_shared/{ensureDir-C_kuQ5Ik.js → ensureDir-DNlPftys.js} +2 -2
- package/dist/packem_shared/{ensureDirSync-CI5g-uBI.js → ensureDirSync-DcPZFMy5.js} +2 -2
- package/dist/packem_shared/{ensureFile-BUtXGlGT.js → ensureFile-BRQpUOUM.js} +2 -2
- package/dist/packem_shared/{ensureFileSync-C8hASR-1.js → ensureFileSync-SBY7A9-C.js} +2 -2
- package/dist/packem_shared/{ensureLink-BPnAG5-P.js → ensureLink-DJQeauEn.js} +4 -3
- package/dist/packem_shared/{ensureLinkSync-B-Z7X0ub.js → ensureLinkSync-D9RVAglV.js} +4 -3
- package/dist/packem_shared/{ensureSymlink-U5B6J0BN.js → ensureSymlink-CoRYDRwr.js} +10 -3
- package/dist/packem_shared/{ensureSymlinkSync-DHnZj-9F.js → ensureSymlinkSync-CFimFlgh.js} +10 -3
- package/dist/packem_shared/{findUp-BSnyGqer.js → findUp-YcNLKdfV.js} +3 -4
- package/dist/packem_shared/{findUpSync-jRHbSCMV.js → findUpSync-BfA5fheN.js} +1 -3
- package/dist/packem_shared/glob-DY8l7izD.js +5 -0
- package/dist/packem_shared/glob-sync.d-BlGjS68e.d.ts +4 -0
- package/dist/packem_shared/globSync-5P2KJf_g.js +5 -0
- package/dist/packem_shared/index-C8W8sfzP.js +830 -0
- package/dist/packem_shared/index-bhgnhm4u.js +167 -0
- package/dist/packem_shared/index-xe4o3cYi.js +1784 -0
- package/dist/packem_shared/{parseJson-C8xb-3LR.js → indexToLineColumn-BUb0GPKl-BF770uX7.js} +8 -68
- package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +251 -0
- package/dist/packem_shared/{isFsCaseSensitive-D-ayleCy.js → isFsCaseSensitive-DunL7Iry.js} +6 -6
- package/dist/packem_shared/json-error.d-DgKaeuIf.d.ts +10 -0
- package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +72 -0
- package/dist/packem_shared/parseJson-BIp89Xjo.js +63 -0
- package/dist/packem_shared/{readFileSync-6GEIrOnl.js → readFileSync-gm9yfIhh.js} +2 -1
- package/dist/packem_shared/readIni-CJ2xfpjB.js +10 -0
- package/dist/packem_shared/readIniSync-9LUjaSSp.js +10 -0
- package/dist/packem_shared/{readJson-vddQ97Ll.js → readJson-C_rwm-wq.js} +1 -1
- package/dist/packem_shared/readJson5-mBoTZppy.js +15 -0
- package/dist/packem_shared/readJson5Sync-8WS2yUok.js +15 -0
- package/dist/packem_shared/{readJsonSync-DzeAdYZl.js → readJsonSync-BMEmCcJ6.js} +2 -2
- package/dist/packem_shared/readJsonc-j-OS-APg.js +28 -0
- package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +16 -0
- package/dist/packem_shared/readToml-B2MHaSes.js +9 -0
- package/dist/packem_shared/readTomlSync-DNbK8NEb.js +9 -0
- package/dist/packem_shared/{readYamlSync-DMV4U-gi.js → readYamlSync-BKX-PAfq.js} +1 -1
- package/dist/packem_shared/{remove-_oDY3uKo.js → remove-C8_gl3jF.js} +2 -1
- package/dist/packem_shared/{removeSync-DETRj7Qn.js → removeSync-BJR_wTwN.js} +2 -1
- package/dist/packem_shared/{sanitize-lOzE6k2A.js → sanitize-BZoLN9Fg.js} +3 -3
- package/dist/packem_shared/types.d-CYpAhWov.d.ts +145 -0
- package/dist/packem_shared/{walk-BhTbpr3y.js → walk-CSZgCuDx.js} +19 -10
- package/dist/packem_shared/{walkSync-DDBq95s8.js → walkSync-C4Cy28xb.js} +25 -16
- package/dist/packem_shared/{writeFile-DSHERs0Z.js → writeFile-B8HX0JIQ.js} +1 -3
- package/dist/packem_shared/{writeFileSync-CJp1kXQR.js → writeFileSync-DB8vv8xR.js} +1 -3
- package/dist/packem_shared/writeIni-i55QrL8y.js +65 -0
- package/dist/packem_shared/writeIniSync-CLqJE5t3.js +64 -0
- package/dist/packem_shared/{writeJson-C0OfLDbe.js → writeJson-Bo7C2UHw.js} +1 -1
- package/dist/packem_shared/writeJson5-vVmHUQOd.js +53 -0
- package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +53 -0
- package/dist/packem_shared/{writeJsonSync-Cs21FE7v.js → writeJsonSync-BKZ_9Acr.js} +1 -1
- package/dist/packem_shared/writeJsonc-BufH_oC5.js +60 -0
- package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +59 -0
- package/dist/packem_shared/writeToml-DgTW_-7F.js +8 -0
- package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +8 -0
- package/dist/packem_shared/{writeYaml-n4xzYN9a.js → writeYaml-BWCOome-.js} +3 -3
- package/dist/packem_shared/{writeYamlSync-DnOEnP10.js → writeYamlSync-DBVnXmuY.js} +3 -3
- package/dist/size.d.ts +10 -254
- package/dist/size.js +6 -4
- package/dist/toml.d.ts +9 -0
- package/dist/toml.js +4 -0
- package/dist/utils.d.ts +15 -6
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +14 -5
- package/dist/yaml.js +3 -3
- package/package.json +60 -6
- package/dist/constants.d.ts +0 -42
- package/dist/ensure/ensure-dir-sync.d.ts +0 -14
- package/dist/ensure/ensure-dir.d.ts +0 -14
- package/dist/ensure/ensure-file-sync.d.ts +0 -15
- package/dist/ensure/ensure-file.d.ts +0 -27
- package/dist/ensure/ensure-link-sync.d.ts +0 -16
- package/dist/ensure/ensure-link.d.ts +0 -16
- package/dist/ensure/ensure-symlink-sync.d.ts +0 -23
- package/dist/ensure/ensure-symlink.d.ts +0 -23
- package/dist/ensure/utils/get-file-info-type.d.ts +0 -7
- package/dist/ensure/utils/is-stats-identical.d.ts +0 -3
- package/dist/ensure/utils/resolve-symlink-target.d.ts +0 -2
- package/dist/error/already-exists-error.d.ts +0 -39
- package/dist/error/directory-error.d.ts +0 -47
- package/dist/error/json-error.d.ts +0 -52
- package/dist/error/not-empty-error.d.ts +0 -51
- package/dist/error/not-found-error.d.ts +0 -44
- package/dist/error/permission-error.d.ts +0 -45
- package/dist/error/walk-error.d.ts +0 -51
- package/dist/find/collect-sync.d.ts +0 -31
- package/dist/find/collect.d.ts +0 -35
- package/dist/find/find-up-sync.d.ts +0 -42
- package/dist/find/find-up.d.ts +0 -46
- package/dist/find/utils/glob-to-regexp.d.ts +0 -2
- package/dist/find/utils/walk-include.d.ts +0 -2
- package/dist/find/walk-sync.d.ts +0 -34
- package/dist/find/walk.d.ts +0 -37
- package/dist/is-accessible-sync.d.ts +0 -3
- package/dist/is-accessible.d.ts +0 -29
- package/dist/move/index.d.ts +0 -68
- package/dist/move/types.d.ts +0 -36
- package/dist/move/utils/internal-move-file-sync.d.ts +0 -3
- package/dist/move/utils/internal-move-file.d.ts +0 -3
- package/dist/move/utils/validate-same-directory.d.ts +0 -2
- package/dist/read/read-file-sync.d.ts +0 -37
- package/dist/read/read-file.d.ts +0 -41
- package/dist/read/read-json-sync.d.ts +0 -5
- package/dist/read/read-json.d.ts +0 -5
- package/dist/read/read-yaml-sync.d.ts +0 -4
- package/dist/read/read-yaml.d.ts +0 -4
- package/dist/remove/empty-dir-sync.d.ts +0 -23
- package/dist/remove/empty-dir.d.ts +0 -28
- package/dist/remove/remove-sync.d.ts +0 -27
- package/dist/remove/remove.d.ts +0 -32
- package/dist/sanitize.d.ts +0 -31
- package/dist/types.d.ts +0 -304
- package/dist/utils/assert-valid-file-contents.d.ts +0 -27
- package/dist/utils/assert-valid-file-or-directory-path.d.ts +0 -26
- package/dist/utils/parse-json.d.ts +0 -5
- package/dist/utils/strip-json-comments.d.ts +0 -44
- package/dist/write/utils/to-uint-8-array.d.ts +0 -2
- package/dist/write/write-file-sync.d.ts +0 -30
- package/dist/write/write-file.d.ts +0 -30
- package/dist/write/write-json-sync.d.ts +0 -29
- package/dist/write/write-json.d.ts +0 -30
- package/dist/write/write-yaml-sync.d.ts +0 -4
- package/dist/write/write-yaml.d.ts +0 -4
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { WalkOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Synchronously collects all file paths within a directory that match the specified criteria.
|
|
4
|
-
* By default, it searches for JavaScript and TypeScript file extensions.
|
|
5
|
-
* @param directory The root directory to start collecting files from.
|
|
6
|
-
* @param options Optional configuration to control the collection process. See {@link WalkOptions}.
|
|
7
|
-
* @returns An array of absolute file paths.
|
|
8
|
-
* @example
|
|
9
|
-
* ```javascript
|
|
10
|
-
* import { collectSync } from "@visulima/fs";
|
|
11
|
-
* import { join } from "node:path";
|
|
12
|
-
*
|
|
13
|
-
* // Collect all .txt and .md files in /tmp/docs, up to 2 levels deep
|
|
14
|
-
* const files = collectSync(join("/tmp", "docs"), {
|
|
15
|
-
* extensions: ["txt", "md"],
|
|
16
|
-
* maxDepth: 2,
|
|
17
|
-
* includeDirs: false, // Only collect files
|
|
18
|
-
* });
|
|
19
|
-
* console.log(files);
|
|
20
|
-
* // Example output: ['/tmp/docs/file1.txt', '/tmp/docs/subdir/report.md']
|
|
21
|
-
*
|
|
22
|
-
* // Collect all .js files, excluding anything in node_modules
|
|
23
|
-
* const jsFiles = collectSync(join("/tmp", "project"), {
|
|
24
|
-
* extensions: ["js"],
|
|
25
|
-
* skip: [/node_modules/],
|
|
26
|
-
* });
|
|
27
|
-
* console.log(jsFiles);
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
declare const collectSync: (directory: string, options?: WalkOptions) => string[];
|
|
31
|
-
export default collectSync;
|
package/dist/find/collect.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { WalkOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Asynchronously collects all file paths within a directory that match the specified criteria.
|
|
4
|
-
* By default, it searches for JavaScript and TypeScript file extensions.
|
|
5
|
-
* @param directory The root directory to start collecting files from.
|
|
6
|
-
* @param options Optional configuration to control the collection process. See {@link WalkOptions}.
|
|
7
|
-
* @returns A promise that resolves to an array of absolute file paths.
|
|
8
|
-
* @example
|
|
9
|
-
* ```javascript
|
|
10
|
-
* import { collect } from "@visulima/fs";
|
|
11
|
-
* import { join } from "node:path";
|
|
12
|
-
*
|
|
13
|
-
* const collectFiles = async () => {
|
|
14
|
-
* // Collect all .txt and .md files in /tmp/docs, up to 2 levels deep
|
|
15
|
-
* const files = await collect(join("/tmp", "docs"), {
|
|
16
|
-
* extensions: ["txt", "md"],
|
|
17
|
-
* maxDepth: 2,
|
|
18
|
-
* includeDirs: false, // Only collect files
|
|
19
|
-
* });
|
|
20
|
-
* console.log(files);
|
|
21
|
-
* // Example output: ['/tmp/docs/file1.txt', '/tmp/docs/subdir/report.md']
|
|
22
|
-
*
|
|
23
|
-
* // Collect all .js files, excluding anything in node_modules
|
|
24
|
-
* const jsFiles = await collect(join("/tmp", "project"), {
|
|
25
|
-
* extensions: ["js"],
|
|
26
|
-
* skip: [/node_modules/],
|
|
27
|
-
* });
|
|
28
|
-
* console.log(jsFiles);
|
|
29
|
-
* };
|
|
30
|
-
*
|
|
31
|
-
* collectFiles();
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
|
|
35
|
-
export default collect;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { FindUpNameSync, FindUpOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Synchronously finds a file or directory by walking up parent directories.
|
|
4
|
-
* @param name The name(s) of the file or directory to find. Can be a string, an array of strings, or a function that returns a name or `FIND_UP_STOP`.
|
|
5
|
-
* @param options Optional configuration for the search. See {@link FindUpOptions}.
|
|
6
|
-
* @returns The absolute path of the first found file/directory, or `undefined` if not found.
|
|
7
|
-
* @example
|
|
8
|
-
* ```javascript
|
|
9
|
-
* import { findUpSync } from "@visulima/fs";
|
|
10
|
-
* import { join } from "node:path";
|
|
11
|
-
*
|
|
12
|
-
* // Find the closest package.json, starting from /tmp/foo/bar/baz
|
|
13
|
-
* const projectRoot = findUpSync("package.json", {
|
|
14
|
-
* cwd: join("/tmp", "foo", "bar", "baz"),
|
|
15
|
-
* type: "file",
|
|
16
|
-
* });
|
|
17
|
-
* console.log(projectRoot); // e.g., /tmp/foo/package.json or undefined
|
|
18
|
-
*
|
|
19
|
-
* // Find the closest .git directory or a README.md file
|
|
20
|
-
* const gitDirOrReadme = findUpSync([".git", "README.md"], {
|
|
21
|
-
* cwd: join("/tmp", "foo", "bar"),
|
|
22
|
-
* });
|
|
23
|
-
* console.log(gitDirOrReadme);
|
|
24
|
-
*
|
|
25
|
-
* // Find using a custom function, stopping at /tmp
|
|
26
|
-
* const customFound = findUpSync(
|
|
27
|
-
* (directory) => {
|
|
28
|
-
* if (directory === join("/tmp", "foo")) {
|
|
29
|
-
* return "found-it-here.txt"; // Pretend this file exists in /tmp/foo
|
|
30
|
-
* }
|
|
31
|
-
* return undefined;
|
|
32
|
-
* },
|
|
33
|
-
* {
|
|
34
|
-
* cwd: join("/tmp", "foo", "bar", "baz"),
|
|
35
|
-
* stopAt: join("/tmp"),
|
|
36
|
-
* }
|
|
37
|
-
* );
|
|
38
|
-
* console.log(customFound);
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
declare const findUpSync: (name: FindUpNameSync, options?: FindUpOptions) => string | undefined;
|
|
42
|
-
export default findUpSync;
|
package/dist/find/find-up.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { FindUpName, FindUpOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Asynchronously finds a file or directory by walking up parent directories.
|
|
4
|
-
* @param name The name(s) of the file or directory to find. Can be a string, an array of strings, or a function that returns a name or `FIND_UP_STOP`.
|
|
5
|
-
* @param options Optional configuration for the search. See {@link FindUpOptions}.
|
|
6
|
-
* @returns A promise that resolves to the absolute path of the first found file/directory, or `undefined` if not found.
|
|
7
|
-
* @example
|
|
8
|
-
* ```javascript
|
|
9
|
-
* import { findUp } from "@visulima/fs";
|
|
10
|
-
* import { join } from "node:path";
|
|
11
|
-
*
|
|
12
|
-
* const findProjectRoot = async () => {
|
|
13
|
-
* // Find the closest package.json, starting from /tmp/foo/bar/baz
|
|
14
|
-
* const projectRoot = await findUp("package.json", {
|
|
15
|
-
* cwd: join("/tmp", "foo", "bar", "baz"),
|
|
16
|
-
* type: "file",
|
|
17
|
-
* });
|
|
18
|
-
* console.log(projectRoot); // e.g., /tmp/foo/package.json or undefined
|
|
19
|
-
*
|
|
20
|
-
* // Find the closest .git directory or a README.md file
|
|
21
|
-
* const gitDirOrReadme = await findUp([".git", "README.md"], {
|
|
22
|
-
* cwd: join("/tmp", "foo", "bar"),
|
|
23
|
-
* });
|
|
24
|
-
* console.log(gitDirOrReadme);
|
|
25
|
-
*
|
|
26
|
-
* // Find using a custom function, stopping at /tmp
|
|
27
|
-
* const customFound = await findUp(
|
|
28
|
-
* (directory) => {
|
|
29
|
-
* if (directory === join("/tmp", "foo")) {
|
|
30
|
-
* return "found-it-here.txt"; // Pretend this file exists in /tmp/foo
|
|
31
|
-
* }
|
|
32
|
-
* return undefined;
|
|
33
|
-
* },
|
|
34
|
-
* {
|
|
35
|
-
* cwd: join("/tmp", "foo", "bar", "baz"),
|
|
36
|
-
* stopAt: join("/tmp"),
|
|
37
|
-
* }
|
|
38
|
-
* );
|
|
39
|
-
* console.log(customFound);
|
|
40
|
-
* };
|
|
41
|
-
*
|
|
42
|
-
* findProjectRoot();
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
declare const findUp: (name: FindUpName, options?: FindUpOptions) => Promise<string | undefined>;
|
|
46
|
-
export default findUp;
|
package/dist/find/walk-sync.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { WalkEntry, WalkOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Synchronously walks the file tree rooted at `directory`, yielding each file or directory that matches the criteria specified in `options`.
|
|
4
|
-
* This is the synchronous version of the {@linkcode walk} function.
|
|
5
|
-
* @param directory The root directory to start walking from.
|
|
6
|
-
* @param options Optional configuration to control the walking process. See {@link WalkOptions}.
|
|
7
|
-
* @param options.extensions List of file extensions used to filter entries.
|
|
8
|
-
* @param options.followSymlinks Indicates whether symlinks should be resolved or not.
|
|
9
|
-
* @param options.includeDirs Indicates whether directory entries should be included or not.
|
|
10
|
-
* @param options.includeFiles Indicates whether file entries should be included or not.
|
|
11
|
-
* @param options.includeSymlinks Indicates whether symlink entries should be included or not.
|
|
12
|
-
* @param options.match List of regular expression or glob patterns used to filter entries.
|
|
13
|
-
* @param options.maxDepth Maximum depth to walk. Defaults to infinity.
|
|
14
|
-
* @param options.skip List of regular expression or glob patterns used to skip entries.
|
|
15
|
-
* @returns An iterable iterator yielding {@link WalkEntry} objects for each matching file or directory.
|
|
16
|
-
* @example
|
|
17
|
-
* ```javascript
|
|
18
|
-
* import { walkSync } from "@visulima/fs";
|
|
19
|
-
* import { join } from "node:path";
|
|
20
|
-
*
|
|
21
|
-
* // Walk through /tmp/my-project, looking for .ts files, max depth 2
|
|
22
|
-
* for (const entry of walkSync(join("/tmp", "my-project"), { extensions: ["ts"], maxDepth: 2 })) {
|
|
23
|
-
* console.log(`Found: ${entry.path} (Type: ${entry.isFile() ? 'file' : 'directory'})`);
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* // Walk, including only directories, and skip any node_modules folders
|
|
27
|
-
* for (const entry of walkSync(join("/tmp", "another-project"), { includeFiles: false, skip: [/node_modules/] })) {
|
|
28
|
-
* if (entry.isDirectory()) {
|
|
29
|
-
* console.log(`Directory: ${entry.path}`);
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export default function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
|
package/dist/find/walk.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { WalkEntry, WalkOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Asynchronously walks the file tree rooted at `directory`, yielding each file or directory that matches the criteria specified in `options`.
|
|
4
|
-
* @param directory The root directory to start walking from.
|
|
5
|
-
* @param options Optional configuration to control the walking process. See {@link WalkOptions}.
|
|
6
|
-
* @param options.extensions List of file extensions used to filter entries.
|
|
7
|
-
* @param options.followSymlinks Indicates whether symlinks should be resolved or not.
|
|
8
|
-
* @param options.includeDirs Indicates whether directory entries should be included or not.
|
|
9
|
-
* @param options.includeFiles Indicates whether file entries should be included or not.
|
|
10
|
-
* @param options.includeSymlinks Indicates whether symlink entries should be included or not.
|
|
11
|
-
* @param options.match List of regular expression or glob patterns used to filter entries.
|
|
12
|
-
* @param options.maxDepth Maximum depth to walk. Defaults to infinity.
|
|
13
|
-
* @param options.skip List of regular expression or glob patterns used to skip entries.
|
|
14
|
-
* @returns An async iterable iterator yielding {@link WalkEntry} objects for each matching file or directory.
|
|
15
|
-
* @example
|
|
16
|
-
* ```javascript
|
|
17
|
-
* import { walk } from "@visulima/fs";
|
|
18
|
-
* import { join } from "node:path";
|
|
19
|
-
*
|
|
20
|
-
* const printEntries = async () => {
|
|
21
|
-
* // Walk through /tmp/my-project, looking for .ts files, max depth 2
|
|
22
|
-
* for await (const entry of walk(join("/tmp", "my-project"), { extensions: ["ts"], maxDepth: 2 })) {
|
|
23
|
-
* console.log(`Found: ${entry.path} (Type: ${entry.isFile() ? 'file' : 'directory'})`);
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* // Walk, including only directories, and skip any node_modules folders
|
|
27
|
-
* for await (const entry of walk(join("/tmp", "another-project"), { includeFiles: false, skip: [/node_modules/] })) {
|
|
28
|
-
* if (entry.isDirectory()) {
|
|
29
|
-
* console.log(`Directory: ${entry.path}`);
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* };
|
|
33
|
-
*
|
|
34
|
-
* printEntries();
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export default function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
package/dist/is-accessible.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Asynchronously tests a user's permissions for the file or directory specified by path.
|
|
3
|
-
* Returns a Promise that resolves to `true` if the accessibility check is successful, `false` otherwise.
|
|
4
|
-
* @param path The path to the file or directory. Can be a string or a URL object.
|
|
5
|
-
* @param mode The accessibility checks to perform. Defaults to `F_OK` (check for existence).
|
|
6
|
-
* Other possible values include `R_OK` (check for read access), `W_OK` (check for write access),
|
|
7
|
-
* and `X_OK` (check for execute/search access). Multiple modes can be combined using bitwise OR.
|
|
8
|
-
* @returns A Promise that resolves to a boolean indicating if the path is accessible with the specified mode.
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { isAccessible, F_OK, R_OK } from "@visulima/fs";
|
|
12
|
-
*
|
|
13
|
-
* (async () => {
|
|
14
|
-
* if (await isAccessible("myFile.txt")) {
|
|
15
|
-
* console.log("myFile.txt exists");
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* if (await isAccessible("myFile.txt", R_OK)) {
|
|
19
|
-
* console.log("myFile.txt is readable");
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* if (await isAccessible("myDirectory", F_OK | R_OK | W_OK)) {
|
|
23
|
-
* console.log("myDirectory exists, is readable and writable");
|
|
24
|
-
* }
|
|
25
|
-
* })();
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
declare function isAccessible(path: URL | string, mode?: number): Promise<boolean>;
|
|
29
|
-
export default isAccessible;
|
package/dist/move/index.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Modified functions from https://github.com/sindresorhus/move-file
|
|
3
|
-
*
|
|
4
|
-
* The original functions are licensed under the MIT License:
|
|
5
|
-
*
|
|
6
|
-
* MIT License
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
9
|
-
*/
|
|
10
|
-
import type { Options } from './types.d.ts';
|
|
11
|
-
/**
|
|
12
|
-
* Move a file asynchronously.
|
|
13
|
-
* @param sourcePath The file you want to move.
|
|
14
|
-
* @param destinationPath Where you want the file moved.
|
|
15
|
-
* @param options Configuration options.
|
|
16
|
-
* @returns A `Promise` that resolves when the file has been moved.
|
|
17
|
-
* @example
|
|
18
|
-
* ```
|
|
19
|
-
* import { move } from '@visulima/fs';
|
|
20
|
-
*
|
|
21
|
-
* await move('source/test.png', 'destination/test.png');
|
|
22
|
-
* console.log('The file has been moved');
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const move: (sourcePath: string, destinationPath: string, options?: Options) => Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Move a file synchronously.
|
|
28
|
-
* @param sourcePath The file you want to move.
|
|
29
|
-
* @param destinationPath Where you want the file moved.
|
|
30
|
-
* @param options Configuration options.
|
|
31
|
-
* @example
|
|
32
|
-
* ```
|
|
33
|
-
* import { moveSync } from '@visulima/fs';
|
|
34
|
-
*
|
|
35
|
-
* moveSync('source/test.png', 'destination/test.png');
|
|
36
|
-
* console.log('The file has been moved');
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare const moveSync: (sourcePath: string, destinationPath: string, options?: Options) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Rename a file asynchronously.
|
|
42
|
-
* @param source The file you want to rename.
|
|
43
|
-
* @param destination The name of the renamed file.
|
|
44
|
-
* @param options Configuration options.
|
|
45
|
-
* @returns A `Promise` that resolves when the file has been renamed.
|
|
46
|
-
* @example
|
|
47
|
-
* ```
|
|
48
|
-
* import { rename } from '@visulima/fs';
|
|
49
|
-
*
|
|
50
|
-
* await rename('test.png', 'tests.png', {cwd: 'source'});
|
|
51
|
-
* console.log('The file has been renamed');
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
export declare const rename: (source: string, destination: string, options?: Options) => Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Rename a file synchronously.
|
|
57
|
-
* @param source The file you want to rename.
|
|
58
|
-
* @param destination The name of the renamed file.
|
|
59
|
-
* @param options Configuration options.
|
|
60
|
-
* @example
|
|
61
|
-
* ```
|
|
62
|
-
* import { renameSync } from '@visulima/fs';
|
|
63
|
-
*
|
|
64
|
-
* renameSync('test.png', 'tests.png', {cwd: 'source'});
|
|
65
|
-
* console.log('The file has been renamed');
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export declare const renameSync: (source: string, destination: string, options?: Options) => void;
|
package/dist/move/types.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type Options = {
|
|
2
|
-
/**
|
|
3
|
-
* The working directory to find source files.
|
|
4
|
-
* The source and destination path are relative to this.
|
|
5
|
-
* @default process.cwd()
|
|
6
|
-
*/
|
|
7
|
-
cwd?: URL | string;
|
|
8
|
-
/**
|
|
9
|
-
* [Permissions](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) for created directories.
|
|
10
|
-
*
|
|
11
|
-
* It has no effect on Windows.
|
|
12
|
-
* @default 0o777
|
|
13
|
-
*/
|
|
14
|
-
readonly directoryMode?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Overwrite existing destination file.
|
|
17
|
-
* @default true
|
|
18
|
-
*/
|
|
19
|
-
readonly overwrite?: boolean;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Internal options used by the move/rename implementation.
|
|
23
|
-
* Extends the public Options type with additional internal properties.
|
|
24
|
-
*/
|
|
25
|
-
export type InternalOptions = Options & {
|
|
26
|
-
/**
|
|
27
|
-
* Resolved working directory path.
|
|
28
|
-
* URLs from the Options type are converted to string paths.
|
|
29
|
-
*/
|
|
30
|
-
cwd: string;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to validate the directory structure before operation.
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
35
|
-
validateDirectory?: boolean;
|
|
36
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ContentType, ReadFileOptions } from "../types.d.ts";
|
|
2
|
-
type DecompressionMethod = (buffer: Buffer, callback: (error: Error | null, result: Buffer) => void) => void;
|
|
3
|
-
declare const decompressionMethods: Record<string, DecompressionMethod>;
|
|
4
|
-
/**
|
|
5
|
-
* Synchronously reads the entire contents of a file.
|
|
6
|
-
* It can also decompress the file content if a `compression` option is provided.
|
|
7
|
-
* @template O - The type of the options object, extending {@link ReadFileOptions}.
|
|
8
|
-
* @param path The path to the file to read. Can be a file URL or a string path.
|
|
9
|
-
* @param options Optional configuration for reading the file. See {@link ReadFileOptions}.
|
|
10
|
-
* Available `compression` methods: "brotli", "gzip", "none" (default).
|
|
11
|
-
* @returns The file content. The type of the content (string or Buffer)
|
|
12
|
-
* depends on the `buffer` option (defaults to string if `buffer` is false or not set).
|
|
13
|
-
* @example
|
|
14
|
-
* ```javascript
|
|
15
|
-
* import { readFileSync } from "@visulima/fs";
|
|
16
|
-
* import { join } from "node:path";
|
|
17
|
-
*
|
|
18
|
-
* try {
|
|
19
|
-
* // Read a regular text file
|
|
20
|
-
* const content = readFileSync(join("path", "to", "my-file.txt"));
|
|
21
|
-
* console.log("File content:", content);
|
|
22
|
-
*
|
|
23
|
-
* // Read a file as a Buffer
|
|
24
|
-
* const bufferContent = readFileSync(join("path", "to", "another-file.bin"), { buffer: true });
|
|
25
|
-
* console.log("Buffer length:", bufferContent.length);
|
|
26
|
-
*
|
|
27
|
-
* // Read and decompress a gzipped file
|
|
28
|
-
* // Assume my-archive.txt.gz exists
|
|
29
|
-
* // const decompressedContent = readFileSync(join("path", "to", "my-archive.txt.gz"), { compression: "gzip", encoding: "utf8" });
|
|
30
|
-
* // console.log("Decompressed content:", decompressedContent);
|
|
31
|
-
* } catch (error) {
|
|
32
|
-
* console.error("Failed to read file:", error);
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
declare const readFileSync: <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O>;
|
|
37
|
-
export default readFileSync;
|
package/dist/read/read-file.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ContentType, ReadFileOptions } from "../types.d.ts";
|
|
2
|
-
type DecompressionMethod = (buffer: Buffer, callback: (error: Error | null, result: Buffer) => void) => void;
|
|
3
|
-
declare const decompressionMethods: Record<string, DecompressionMethod>;
|
|
4
|
-
/**
|
|
5
|
-
* Asynchronously reads the entire contents of a file.
|
|
6
|
-
* It can also decompress the file content if a `compression` option is provided.
|
|
7
|
-
* @template O - The type of the options object, extending {@link ReadFileOptions}.
|
|
8
|
-
* @param path The path to the file to read. Can be a file URL or a string path.
|
|
9
|
-
* @param options Optional configuration for reading the file. See {@link ReadFileOptions}.
|
|
10
|
-
* Available `compression` methods: "brotli", "gzip", "none" (default).
|
|
11
|
-
* @returns A promise that resolves with the file content. The type of the content (string or Buffer)
|
|
12
|
-
* depends on the `buffer` option (defaults to string if `buffer` is false or not set).
|
|
13
|
-
* @example
|
|
14
|
-
* ```javascript
|
|
15
|
-
* import { readFile } from "@visulima/fs";
|
|
16
|
-
* import { join } from "node:path";
|
|
17
|
-
*
|
|
18
|
-
* const readMyFile = async () => {
|
|
19
|
-
* try {
|
|
20
|
-
* // Read a regular text file
|
|
21
|
-
* const content = await readFile(join("path", "to", "my-file.txt"));
|
|
22
|
-
* console.log("File content:", content);
|
|
23
|
-
*
|
|
24
|
-
* // Read a file as a Buffer
|
|
25
|
-
* const bufferContent = await readFile(join("path", "to", "another-file.bin"), { buffer: true });
|
|
26
|
-
* console.log("Buffer length:", bufferContent.length);
|
|
27
|
-
*
|
|
28
|
-
* // Read and decompress a gzipped file
|
|
29
|
-
* // Assume my-archive.txt.gz exists
|
|
30
|
-
* // const decompressedContent = await readFile(join("path", "to", "my-archive.txt.gz"), { compression: "gzip", encoding: "utf8" });
|
|
31
|
-
* // console.log("Decompressed content:", decompressedContent);
|
|
32
|
-
* } catch (error) {
|
|
33
|
-
* console.error("Failed to read file:", error);
|
|
34
|
-
* }
|
|
35
|
-
* };
|
|
36
|
-
*
|
|
37
|
-
* readMyFile();
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
declare const readFile: <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O>>;
|
|
41
|
-
export default readFile;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { JsonValue } from "type-fest";
|
|
2
|
-
import type { JsonReviver, ReadJsonOptions } from "../types.d.ts";
|
|
3
|
-
declare function readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;
|
|
4
|
-
declare function readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;
|
|
5
|
-
export default readJsonSync;
|
package/dist/read/read-json.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { JsonValue } from "type-fest";
|
|
2
|
-
import type { JsonReviver, ReadJsonOptions } from "../types.d.ts";
|
|
3
|
-
declare function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;
|
|
4
|
-
declare function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;
|
|
5
|
-
export default readJson;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CompressionType, ReadYamlOptions, YamlReviver } from "../types.d.ts";
|
|
2
|
-
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<CompressionType>): R;
|
|
3
|
-
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<CompressionType>): R;
|
|
4
|
-
export default readYamlSync;
|
package/dist/read/read-yaml.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CompressionType, ReadYamlOptions, YamlReviver } from "../types.d.ts";
|
|
2
|
-
declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<CompressionType>): Promise<R>;
|
|
3
|
-
declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<CompressionType>): Promise<R>;
|
|
4
|
-
export default readYaml;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { RetryOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Ensures that a directory is empty.
|
|
4
|
-
* Deletes directory contents if the directory is not empty.
|
|
5
|
-
* If the directory does not exist, it is created.
|
|
6
|
-
* The directory itself is not deleted.
|
|
7
|
-
* @param dir The path to the directory to empty.
|
|
8
|
-
* @param options Optional configuration for the operation. See {@link RetryOptions}.
|
|
9
|
-
* @example
|
|
10
|
-
* ```javascript
|
|
11
|
-
* import { emptyDirSync } from "@visulima/fs";
|
|
12
|
-
* import { join } from "node:path";
|
|
13
|
-
*
|
|
14
|
-
* try {
|
|
15
|
-
* emptyDirSync(join("/tmp", "my-app-temp"));
|
|
16
|
-
* console.log("Temporary directory emptied or created.");
|
|
17
|
-
* } catch (error) {
|
|
18
|
-
* console.error("Failed to empty directory:", error);
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
declare const emptyDirSync: (dir: URL | string, options?: RetryOptions) => void;
|
|
23
|
-
export default emptyDirSync;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { RetryOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Ensures that a directory is empty.
|
|
4
|
-
* Deletes directory contents if the directory is not empty.
|
|
5
|
-
* If the directory does not exist, it is created.
|
|
6
|
-
* The directory itself is not deleted.
|
|
7
|
-
* @param dir The path to the directory to empty.
|
|
8
|
-
* @param options Optional configuration for the operation. See {@link RetryOptions}.
|
|
9
|
-
* @returns A promise that resolves when the directory is empty.
|
|
10
|
-
* @example
|
|
11
|
-
* ```javascript
|
|
12
|
-
* import { emptyDir } from "@visulima/fs";
|
|
13
|
-
* import { join } from "node:path";
|
|
14
|
-
*
|
|
15
|
-
* const clearTempDir = async () => {
|
|
16
|
-
* try {
|
|
17
|
-
* await emptyDir(join("/tmp", "my-app-temp"));
|
|
18
|
-
* console.log("Temporary directory emptied or created.");
|
|
19
|
-
* } catch (error) {
|
|
20
|
-
* console.error("Failed to empty directory:", error);
|
|
21
|
-
* }
|
|
22
|
-
* };
|
|
23
|
-
*
|
|
24
|
-
* clearTempDir();
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
declare const emptyDir: (dir: URL | string, options?: RetryOptions) => Promise<void>;
|
|
28
|
-
export default emptyDir;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { RetryOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Synchronously removes a file or directory (recursively).
|
|
4
|
-
* If the path does not exist, it does nothing.
|
|
5
|
-
* @param path The path to the file or directory to remove.
|
|
6
|
-
* @param options Optional configuration for the operation. See {@link RetryOptions}.
|
|
7
|
-
* @example
|
|
8
|
-
* ```javascript
|
|
9
|
-
* import { removeSync } from "@visulima/fs";
|
|
10
|
-
* import { join } from "node:path";
|
|
11
|
-
*
|
|
12
|
-
* try {
|
|
13
|
-
* removeSync(join("/tmp", "my-file.txt"));
|
|
14
|
-
* console.log("File /tmp/my-file.txt removed.");
|
|
15
|
-
*
|
|
16
|
-
* removeSync(join("/tmp", "my-empty-dir"));
|
|
17
|
-
* console.log("Directory /tmp/my-empty-dir removed.");
|
|
18
|
-
*
|
|
19
|
-
* removeSync(join("/tmp", "my-dir-with-contents"));
|
|
20
|
-
* console.log("Directory /tmp/my-dir-with-contents and its contents removed.");
|
|
21
|
-
* } catch (error) {
|
|
22
|
-
* console.error("Failed to remove path:", error);
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
declare const removeSync: (path: URL | string, options?: RetryOptions) => void;
|
|
27
|
-
export default removeSync;
|
package/dist/remove/remove.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { RetryOptions } from "../types.d.ts";
|
|
2
|
-
/**
|
|
3
|
-
* Asynchronously removes a file or directory (recursively).
|
|
4
|
-
* If the path does not exist, it does nothing.
|
|
5
|
-
* @param path The path to the file or directory to remove.
|
|
6
|
-
* @param options Optional configuration for the operation. See {@link RetryOptions}.
|
|
7
|
-
* @returns A promise that resolves when the path has been removed.
|
|
8
|
-
* @example
|
|
9
|
-
* ```javascript
|
|
10
|
-
* import { remove } from "@visulima/fs";
|
|
11
|
-
* import { join } from "node:path";
|
|
12
|
-
*
|
|
13
|
-
* const deleteFileOrDir = async () => {
|
|
14
|
-
* try {
|
|
15
|
-
* await remove(join("/tmp", "my-file.txt"));
|
|
16
|
-
* console.log("File /tmp/my-file.txt removed.");
|
|
17
|
-
*
|
|
18
|
-
* await remove(join("/tmp", "my-empty-dir"));
|
|
19
|
-
* console.log("Directory /tmp/my-empty-dir removed.");
|
|
20
|
-
*
|
|
21
|
-
* await remove(join("/tmp", "my-dir-with-contents"));
|
|
22
|
-
* console.log("Directory /tmp/my-dir-with-contents and its contents removed.");
|
|
23
|
-
* } catch (error) {
|
|
24
|
-
* console.error("Failed to remove path:", error);
|
|
25
|
-
* }
|
|
26
|
-
* };
|
|
27
|
-
*
|
|
28
|
-
* deleteFileOrDir();
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
declare const remove: (path: URL | string, options?: RetryOptions) => Promise<void>;
|
|
32
|
-
export default remove;
|
package/dist/sanitize.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported filesystem types
|
|
3
|
-
*/
|
|
4
|
-
export type FileSystemType = "win32" | "unix" | "darwin" | "fat32" | "auto";
|
|
5
|
-
/**
|
|
6
|
-
* Options for the sanitize function
|
|
7
|
-
*/
|
|
8
|
-
export interface SanitizeOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Target filesystem type for sanitization rules
|
|
11
|
-
* - "win32": Windows filesystem rules (reserved names, Windows forbidden chars, no trailing periods/spaces)
|
|
12
|
-
* - "unix": Unix/Linux filesystem rules (only / and null forbidden)
|
|
13
|
-
* - "darwin": macOS filesystem rules (same as unix)
|
|
14
|
-
* - "fat32": FAT32 filesystem rules (Windows rules + no leading/trailing spaces/periods in name part)
|
|
15
|
-
* - "auto": Automatically detect from process.platform
|
|
16
|
-
* @default "auto"
|
|
17
|
-
*/
|
|
18
|
-
filesystem?: FileSystemType;
|
|
19
|
-
/**
|
|
20
|
-
* Maximum length of the sanitized name
|
|
21
|
-
* @default 128
|
|
22
|
-
*/
|
|
23
|
-
maxLength?: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Sanitizes a filename by removing or replacing forbidden characters.
|
|
27
|
-
* @param name The filename to sanitize.
|
|
28
|
-
* @param options Optional configuration.
|
|
29
|
-
* @returns The sanitized filename, or "unnamed" if the result would be empty.
|
|
30
|
-
*/
|
|
31
|
-
export declare const sanitize: (name: string, options?: Partial<SanitizeOptions>) => string;
|