@stacksjs/storage 0.64.6 → 0.65.0
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/dist/copy.d.ts +3 -0
- package/dist/delete.d.ts +8 -0
- package/dist/drivers/aws.d.ts +2 -0
- package/dist/drivers/index.d.ts +1 -0
- package/dist/files.d.ts +57 -0
- package/dist/folders.d.ts +16 -0
- package/dist/fs.d.ts +4 -0
- package/dist/glob.d.ts +13 -0
- package/dist/hash.d.ts +5 -0
- package/dist/helpers.d.ts +8 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2 -27
- package/dist/index.js.map +38 -85
- package/dist/move.d.ts +7 -0
- package/dist/storage.d.ts +9 -0
- package/dist/visibility.d.ts +1 -0
- package/dist/zip.d.ts +17 -0
- package/package.json +13 -19
- package/src/copy.ts +8 -4
- package/src/delete.ts +25 -13
- package/src/files.ts +45 -17
- package/src/folders.ts +13 -4
- package/src/fs.ts +1 -1
- package/src/glob.ts +23 -1
- package/src/hash.ts +2 -1
- package/src/helpers.ts +9 -3
- package/src/index.ts +6 -6
- package/src/move.ts +15 -8
- package/src/storage.ts +5 -5
- package/src/visibility.ts +1 -1
- package/src/zip.ts +21 -13
package/dist/copy.d.ts
ADDED
package/dist/delete.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Result } from "@stacksjs/error-handling";
|
|
2
|
+
export declare function deleteFolder(path: string): Promise<Result<string, Error>>;
|
|
3
|
+
export declare function isDirectoryEmpty(path: string): Promise<Result<boolean, Error>>;
|
|
4
|
+
export declare function deleteEmptyFolder(path: string): Promise<Result<string, Error>>;
|
|
5
|
+
export declare function deleteEmptyFolders(dir: string): Promise<Result<string, Error>>;
|
|
6
|
+
export declare function deleteFile(path: string): Promise<Result<string, Error>>;
|
|
7
|
+
export declare function deleteGlob(path: string): Promise<Result<string, Error>>;
|
|
8
|
+
export declare function del(path: string): Promise<Result<string, Error>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as aws from "./aws";
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { JsonFile, PackageJson, TextFile } from "@stacksjs/types";
|
|
2
|
+
/**
|
|
3
|
+
* Reads a JSON file and returns the parsed data.
|
|
4
|
+
*/
|
|
5
|
+
export declare function readJsonFile(name: string, cwd?: string): Promise<JsonFile>;
|
|
6
|
+
/**
|
|
7
|
+
* Reads a package.json file and returns the parsed data.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readPackageJson(name: string, cwd?: string): Promise<PackageJson>;
|
|
10
|
+
/**
|
|
11
|
+
* Writes the given text to the specified file.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeFile(path: string, data: any): Promise<number>;
|
|
14
|
+
/**
|
|
15
|
+
* Writes the given data to the specified JSON file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function writeJsonFile(file: JsonFile): Promise<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Reads a text file and returns its contents.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readTextFile(name: string, cwd?: string): Promise<TextFile>;
|
|
22
|
+
/**
|
|
23
|
+
* Writes the given text to the specified file.
|
|
24
|
+
*/
|
|
25
|
+
export declare function writeTextFile(file: TextFile): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Determine whether a path exists.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isFile(path: string): boolean;
|
|
30
|
+
export declare function doesExist(path: string): boolean;
|
|
31
|
+
export declare function doesNotExist(path: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Determine whether a folder has any files in it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasFiles(folder: string): boolean;
|
|
36
|
+
export declare function hasComponents(): boolean;
|
|
37
|
+
export declare function hasFunctions(): boolean;
|
|
38
|
+
export declare function deleteFiles(dir: string, exclude?: string[]): void;
|
|
39
|
+
export declare function getFiles(dir: string, exclude?: string[]): string[];
|
|
40
|
+
export declare function put(path: string, contents: string): void;
|
|
41
|
+
export declare function get(path: string): Promise<string>;
|
|
42
|
+
export interface Files {
|
|
43
|
+
readJsonFile: typeof readJsonFile;
|
|
44
|
+
readPackageJson: typeof readPackageJson;
|
|
45
|
+
readTextFile: typeof readTextFile;
|
|
46
|
+
writeJsonFile: typeof writeJsonFile;
|
|
47
|
+
writeTextFile: typeof writeTextFile;
|
|
48
|
+
isFile: typeof isFile;
|
|
49
|
+
hasFiles: typeof hasFiles;
|
|
50
|
+
hasComponents: typeof hasComponents;
|
|
51
|
+
hasFunctions: typeof hasFunctions;
|
|
52
|
+
deleteFiles: typeof deleteFiles;
|
|
53
|
+
getFiles: typeof getFiles;
|
|
54
|
+
put: typeof put;
|
|
55
|
+
get: typeof get;
|
|
56
|
+
}
|
|
57
|
+
export declare const files: Files;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine whether a path is a folder.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isFolder(path: string): boolean;
|
|
5
|
+
export declare function isDirectory(path: string): boolean;
|
|
6
|
+
export declare function isDir(path: string): boolean;
|
|
7
|
+
export declare function doesFolderExist(path: string): boolean;
|
|
8
|
+
export declare function createFolder(dir: string): Promise<void>;
|
|
9
|
+
export declare function getFolders(dir: string): string[];
|
|
10
|
+
export interface Folders {
|
|
11
|
+
isFolder: (path: string) => boolean;
|
|
12
|
+
doesFolderExist: (path: string) => boolean;
|
|
13
|
+
createFolder: (dir: string) => Promise<void>;
|
|
14
|
+
getFolders: (dir: string) => string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const folders: Folders;
|
package/dist/fs.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as fs from "fs-extra";
|
|
2
|
+
import { pathExists as existsSync, watch as fsWatch, mkdirSync, readFileSync, watchFile, writeFileSync } from "fs-extra";
|
|
3
|
+
export declare function exists(path: string): Promise<boolean>;
|
|
4
|
+
export { existsSync, fs, fsWatch, mkdirSync, readFileSync, watchFile, writeFileSync };
|
package/dist/glob.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { glob } from "tinyglobby";
|
|
2
|
+
export interface GlobOptions {
|
|
3
|
+
absolute?: boolean;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
patterns?: string[];
|
|
6
|
+
ignore?: string[];
|
|
7
|
+
dot?: boolean;
|
|
8
|
+
deep?: number;
|
|
9
|
+
expandDirectories?: boolean;
|
|
10
|
+
onlyDirectories?: boolean;
|
|
11
|
+
onlyFiles?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function globSync(patterns: string | string[], options?: Omit<GlobOptions, "patterns">): string[];
|
package/dist/hash.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Hash } from "node:crypto";
|
|
2
|
+
export declare function hashFileOrDirectory(path: string, hash: Hash): void;
|
|
3
|
+
export declare function hashDirectory(directory: string): string;
|
|
4
|
+
export declare function hashPath(path: string): string;
|
|
5
|
+
export declare function hashPaths(paths: string | string[]): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const _dirname: string;
|
|
2
|
+
export declare function updateConfigFile(filePath: string, newConfig: Record<string, unknown>): Promise<void>;
|
|
3
|
+
interface Helpers {
|
|
4
|
+
_dirname: string;
|
|
5
|
+
updateConfigFile: (filePath: string, newConfig: Record<string, unknown>) => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare const helpers: Helpers;
|
|
8
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./copy";
|
|
2
|
+
export * from "./delete";
|
|
3
|
+
export * from "./files";
|
|
4
|
+
export * from "./folders";
|
|
5
|
+
export * from "./fs";
|
|
6
|
+
export * from "./glob";
|
|
7
|
+
export * from "./hash";
|
|
8
|
+
export * from "./helpers";
|
|
9
|
+
export * as storage from "./storage";
|
|
10
|
+
export * from "./zip";
|