@stacksjs/storage 0.58.72 → 0.59.1
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/files.d.ts +56 -0
- package/dist/folders.d.ts +15 -0
- package/dist/fs.d.ts +4 -0
- package/dist/glob.d.ts +1 -0
- package/dist/hash.d.ts +6 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -2
- package/dist/move.d.ts +11 -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 +3 -3
- package/src/fs.ts +1 -2
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>>;
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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 declare const 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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 declare const folders: {
|
|
11
|
+
isFolder: typeof isFolder;
|
|
12
|
+
doesFolderExist: typeof doesFolderExist;
|
|
13
|
+
createFolder: typeof createFolder;
|
|
14
|
+
getFolders: typeof getFolders;
|
|
15
|
+
};
|
package/dist/fs.d.ts
ADDED
package/dist/glob.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as glob } from 'fast-glob';
|
package/dist/hash.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Hash } from 'node:crypto';
|
|
3
|
+
export declare function hashFileOrDirectory(path: string, hash: Hash): void;
|
|
4
|
+
export declare function hashDirectory(directory: string): string;
|
|
5
|
+
export declare function hashPath(path: string): string;
|
|
6
|
+
export declare function hashPaths(paths: string | string[]): string;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './files';
|
|
2
|
+
export * from './folders';
|
|
3
|
+
export * from './hash';
|
|
4
|
+
export * from './helpers';
|
|
5
|
+
export * from './fs';
|
|
6
|
+
export * from './copy';
|
|
7
|
+
export * from './glob';
|
|
8
|
+
export * from './delete';
|
|
9
|
+
export * from './zip';
|
|
10
|
+
export * as storage from './storage';
|
package/dist/index.js
CHANGED
|
@@ -16,9 +16,8 @@ import {dirname, join as join2, path as p} from "@stacksjs/path";
|
|
|
16
16
|
import {contains} from "@stacksjs/arrays";
|
|
17
17
|
|
|
18
18
|
// src/fs.ts
|
|
19
|
-
import {mkdirSync, writeFileSync} from "fs";
|
|
20
19
|
import * as fs from "fs-extra";
|
|
21
|
-
import {pathExists as existsSync} from "fs-extra";
|
|
20
|
+
import {pathExists as existsSync, mkdirSync, writeFileSync} from "fs-extra";
|
|
22
21
|
async function exists(path) {
|
|
23
22
|
return await existsSync(path);
|
|
24
23
|
}
|
package/dist/move.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Result } from '@stacksjs/error-handling';
|
|
2
|
+
interface MoveOptions {
|
|
3
|
+
overwrite?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function move(src: string | string[], dest: string, options?: MoveOptions): Promise<Result<{
|
|
6
|
+
message: string;
|
|
7
|
+
}, Error>>;
|
|
8
|
+
export declare function rename(from: string, to: string, options?: MoveOptions): Promise<Result<{
|
|
9
|
+
message: string;
|
|
10
|
+
}, Error>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setVisibility(): string;
|
package/dist/zip.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="bun-types" />
|
|
2
|
+
/// <reference types="bun-types" />
|
|
3
|
+
import type { ZlibCompressionOptions } from 'bun';
|
|
4
|
+
interface ZipOptions {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function zip(from: string | string[], to?: string, options?: ZipOptions): Promise<import("neverthrow").Result<import("bun").Subprocess<import("bun").SpawnOptions.Writable, import("bun").SpawnOptions.Readable, import("bun").SpawnOptions.Readable>, Error>>;
|
|
8
|
+
export declare function unzip(paths: string | string[]): Promise<import("neverthrow").Result<import("bun").Subprocess<import("bun").SpawnOptions.Writable, import("bun").SpawnOptions.Readable, import("bun").SpawnOptions.Readable>, Error>>;
|
|
9
|
+
export declare function archive(paths: string | string[]): Promise<import("neverthrow").Result<import("bun").Subprocess<import("bun").SpawnOptions.Writable, import("bun").SpawnOptions.Readable, import("bun").SpawnOptions.Readable>, Error>>;
|
|
10
|
+
export declare function unarchive(paths: string | string[]): Promise<import("neverthrow").Result<import("bun").Subprocess<import("bun").SpawnOptions.Writable, import("bun").SpawnOptions.Readable, import("bun").SpawnOptions.Readable>, Error>>;
|
|
11
|
+
export declare function compress(paths: string[]): Promise<import("neverthrow").Result<import("bun").Subprocess<import("bun").SpawnOptions.Writable, import("bun").SpawnOptions.Readable, import("bun").SpawnOptions.Readable>, Error>>;
|
|
12
|
+
export declare function decompress(paths: string | string[]): Promise<import("neverthrow").Result<import("bun").Subprocess<import("bun").SpawnOptions.Writable, import("bun").SpawnOptions.Readable, import("bun").SpawnOptions.Readable>, Error>>;
|
|
13
|
+
export declare function gzipSync(data: Uint8Array, options?: ZlibCompressionOptions): Uint8Array;
|
|
14
|
+
export declare function gunzipSync(data: Uint8Array): Uint8Array;
|
|
15
|
+
export declare function deflateSync(data: Uint8Array, options?: ZlibCompressionOptions): Uint8Array;
|
|
16
|
+
export declare function inflateSync(data: Uint8Array): Uint8Array;
|
|
17
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.59.1",
|
|
5
5
|
"description": "The Stacks file system.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@stacksjs/strings": "latest",
|
|
59
59
|
"@stacksjs/types": "latest",
|
|
60
60
|
"@types/archiver": "^6.0.2",
|
|
61
|
-
"archiver": "^
|
|
61
|
+
"archiver": "^7.0.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@stacksjs/arrays": "latest",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@stacksjs/strings": "latest",
|
|
68
68
|
"@stacksjs/types": "latest",
|
|
69
69
|
"@types/archiver": "^6.0.2",
|
|
70
|
-
"archiver": "^
|
|
70
|
+
"archiver": "^7.0.0",
|
|
71
71
|
"fast-glob": "^3.3.2",
|
|
72
72
|
"fs-extra": "^11.2.0",
|
|
73
73
|
"unstorage": "^1.10.1"
|
package/src/fs.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from 'node:fs'
|
|
2
1
|
import * as fs from 'fs-extra'
|
|
3
|
-
import { pathExists as existsSync } from 'fs-extra'
|
|
2
|
+
import { pathExists as existsSync, mkdirSync, writeFileSync } from 'fs-extra'
|
|
4
3
|
|
|
5
4
|
export async function exists(path: string): Promise<boolean> {
|
|
6
5
|
return await existsSync(path)
|