@stacksjs/storage 0.70.88 → 0.70.90

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.
Files changed (71) hide show
  1. package/dist/adapters/bun.d.ts +31 -0
  2. package/dist/adapters/bun.js +226 -0
  3. package/dist/adapters/index.d.ts +6 -0
  4. package/dist/adapters/index.js +5 -0
  5. package/dist/adapters/local.d.ts +38 -0
  6. package/dist/adapters/local.js +225 -0
  7. package/dist/adapters/memory.d.ts +38 -0
  8. package/dist/adapters/memory.js +318 -0
  9. package/dist/adapters/s3.d.ts +53 -0
  10. package/dist/adapters/s3.js +471 -0
  11. package/dist/adapters/scoped.d.ts +68 -0
  12. package/dist/adapters/scoped.js +142 -0
  13. package/dist/copy.d.ts +3 -0
  14. package/dist/copy.js +30 -0
  15. package/dist/delete.d.ts +8 -0
  16. package/dist/delete.js +103 -0
  17. package/dist/drivers/aws.d.ts +4 -0
  18. package/dist/drivers/aws.js +94 -0
  19. package/dist/drivers/bun.d.ts +4 -0
  20. package/dist/drivers/bun.js +88 -0
  21. package/dist/drivers/index.d.ts +4 -0
  22. package/dist/drivers/index.js +4 -0
  23. package/dist/drivers/local.d.ts +4 -0
  24. package/dist/drivers/local.js +88 -0
  25. package/dist/drivers/memory.d.ts +4 -0
  26. package/dist/drivers/memory.js +67 -0
  27. package/dist/facade.d.ts +53 -0
  28. package/dist/facade.js +226 -0
  29. package/dist/files.d.ts +52 -0
  30. package/dist/files.js +126 -0
  31. package/dist/folders.d.ts +18 -0
  32. package/dist/folders.js +36 -0
  33. package/dist/fs.d.ts +4 -0
  34. package/dist/fs.js +7 -0
  35. package/dist/glob.d.ts +13 -0
  36. package/dist/glob.js +40 -0
  37. package/dist/hash.d.ts +5 -0
  38. package/dist/hash.js +33 -0
  39. package/dist/helpers.d.ts +7 -0
  40. package/dist/helpers.js +28 -0
  41. package/dist/image.d.ts +55 -0
  42. package/dist/image.js +29 -0
  43. package/dist/index.d.ts +60 -0
  44. package/dist/index.js +27 -0
  45. package/dist/mime-verify.d.ts +65 -0
  46. package/dist/mime-verify.js +47 -0
  47. package/dist/move.d.ts +6 -0
  48. package/dist/move.js +55 -0
  49. package/dist/path-sanitize.d.ts +92 -0
  50. package/dist/path-sanitize.js +84 -0
  51. package/dist/put-file.d.ts +53 -0
  52. package/dist/put-file.js +85 -0
  53. package/dist/s3-presigned-post.d.ts +52 -0
  54. package/dist/s3-presigned-post.js +68 -0
  55. package/dist/signed-url.d.ts +69 -0
  56. package/dist/signed-url.js +86 -0
  57. package/dist/static-serve.d.ts +37 -0
  58. package/dist/static-serve.js +110 -0
  59. package/dist/storage.d.ts +9 -0
  60. package/dist/storage.js +9 -0
  61. package/dist/types/filesystem.d.ts +131 -0
  62. package/dist/types/filesystem.js +40 -0
  63. package/dist/types.d.ts +229 -0
  64. package/dist/types.js +25 -0
  65. package/dist/uploaded-file.d.ts +38 -0
  66. package/dist/uploaded-file.js +114 -0
  67. package/dist/visibility.d.ts +3 -0
  68. package/dist/visibility.js +3 -0
  69. package/dist/zip.d.ts +16 -0
  70. package/dist/zip.js +41 -0
  71. package/package.json +6 -6
package/dist/copy.js ADDED
@@ -0,0 +1,30 @@
1
+ import { contains } from "@stacksjs/arrays";
2
+ import { join } from "@stacksjs/path";
3
+ import { fs } from "./fs";
4
+ export function copy(src, dest, exclude = []) {
5
+ if (Array.isArray(src))
6
+ src.forEach((file) => {
7
+ copy(file, dest, exclude);
8
+ });
9
+ else if (fs.statSync(src).isDirectory())
10
+ copyFolder(src, dest, exclude);
11
+ else
12
+ copyFile(src, dest);
13
+ }
14
+ export function copyFile(src, dest) {
15
+ fs.copyFileSync(src, dest);
16
+ }
17
+ export function copyFolder(src, dest, exclude = []) {
18
+ if (!fs.existsSync(dest))
19
+ fs.mkdirSync(dest, { recursive: !0 });
20
+ if (fs.existsSync(src))
21
+ fs.readdirSync(src).forEach((file) => {
22
+ if (!contains(join(src, file), exclude)) {
23
+ const srcPath = join(src, file), destPath = join(dest, file);
24
+ if (fs.statSync(srcPath).isDirectory())
25
+ copyFolder(srcPath, destPath, exclude);
26
+ else
27
+ fs.copyFileSync(srcPath, destPath);
28
+ }
29
+ });
30
+ }
@@ -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/delete.js ADDED
@@ -0,0 +1,103 @@
1
+ import { italic, log } from "@stacksjs/cli";
2
+ import { err, handleError, ok } from "@stacksjs/error-handling";
3
+ import { join } from "@stacksjs/path";
4
+ import { isFolder } from "./folders";
5
+ import { fs } from "./fs";
6
+ import { glob } from "./glob";
7
+ export function deleteFolder(path) {
8
+ return new Promise((resolve, reject) => {
9
+ try {
10
+ if (isFolder(path)) {
11
+ fs.rmSync(path, { recursive: !0, force: !0 });
12
+ return resolve(ok(`Deleted ${path}`));
13
+ }
14
+ return resolve(ok(`Path ${path} was not a directory`));
15
+ } catch (error) {
16
+ return reject(err(error));
17
+ }
18
+ });
19
+ }
20
+ export async function isDirectoryEmpty(path) {
21
+ return new Promise((resolve, reject) => {
22
+ try {
23
+ if (fs.statSync(path).isDirectory()) {
24
+ if (fs.readdirSync(path).length === 0)
25
+ return resolve(ok(!0));
26
+ return resolve(ok(!1));
27
+ }
28
+ return resolve(ok(!1));
29
+ } catch (error) {
30
+ return reject(err(error));
31
+ }
32
+ });
33
+ }
34
+ export async function deleteEmptyFolder(path) {
35
+ return new Promise((resolve, reject) => {
36
+ try {
37
+ if (fs.statSync(path).isDirectory()) {
38
+ if (fs.readdirSync(path).length === 0) {
39
+ fs.rmSync(path, { recursive: !0, force: !0 });
40
+ return resolve(ok(`Deleted ${path}`));
41
+ }
42
+ return resolve(ok(`Path ${path} was not empty`));
43
+ }
44
+ return resolve(ok(`Path ${path} was not a directory`));
45
+ } catch (error) {
46
+ return reject(err(error));
47
+ }
48
+ });
49
+ }
50
+ export async function deleteEmptyFolders(dir) {
51
+ try {
52
+ if (!fs.existsSync(dir))
53
+ return ok(`Path ${dir} does not exist`);
54
+ const files = fs.readdirSync(dir);
55
+ for (const file of files) {
56
+ const p = join(dir, file);
57
+ if (isFolder(p))
58
+ if (fs.readdirSync(p).length === 0)
59
+ fs.rmSync(p, { recursive: !0, force: !0 });
60
+ else
61
+ await deleteEmptyFolders(p);
62
+ }
63
+ return ok(`Deleted empty folders located in ${dir}`);
64
+ } catch (error) {
65
+ return err(error);
66
+ }
67
+ }
68
+ export function deleteFile(path) {
69
+ return new Promise((resolve, reject) => {
70
+ try {
71
+ if (fs.statSync(path).isFile()) {
72
+ fs.rmSync(path, { recursive: !0, force: !0 });
73
+ return resolve(ok(`Deleted ${path}`));
74
+ }
75
+ return resolve(ok(`Path ${path} was not a file`));
76
+ } catch (error) {
77
+ return reject(err(error));
78
+ }
79
+ });
80
+ }
81
+ export async function deleteGlob(path) {
82
+ if (!path.includes("*"))
83
+ return err(handleError(`Path ${path} does not contain a glob`));
84
+ const directories = await glob([path], { onlyDirectories: !0 });
85
+ for (const directory of directories) {
86
+ const result = await deleteFolder(directory);
87
+ if (result.isErr) {
88
+ log.error(result.error);
89
+ return result;
90
+ }
91
+ log.info(`Deleted ${italic(directory)}`);
92
+ }
93
+ return ok(`Deleted ${directories.length} directories`);
94
+ }
95
+ export async function del(path) {
96
+ if (fs.existsSync(path) && fs.statSync(path).isFile())
97
+ return await deleteFile(path);
98
+ if (isFolder(path))
99
+ return await deleteFolder(path);
100
+ if (path.includes("*"))
101
+ return await deleteGlob(path);
102
+ return err(handleError(`Path ${path} cannot be deleted due to an unhandled condition. Please report this issue.`));
103
+ }
@@ -0,0 +1,4 @@
1
+ import type { StorageAdapter } from '../types';
2
+ import type { StorageDriver } from '@stacksjs/types';
3
+ export declare function getAwsStorage(): Promise<StorageAdapter>;
4
+ export declare const aws: StorageDriver;
@@ -0,0 +1,94 @@
1
+ import { createS3Storage } from "../adapters/s3";
2
+ let _adapterPromise = null;
3
+ async function loadConfig() {
4
+ try {
5
+ const { filesystems } = await import("@stacksjs/config"), s3Config = filesystems.s3;
6
+ return createS3Storage(null, {
7
+ bucket: s3Config?.bucket || "stacks",
8
+ prefix: s3Config?.prefix || "stx",
9
+ region: s3Config?.region || "us-east-1"
10
+ });
11
+ } catch {
12
+ const { env } = await import("@stacksjs/env");
13
+ return createS3Storage(null, {
14
+ bucket: env.AWS_S3_BUCKET || "stacks",
15
+ prefix: env.AWS_S3_PREFIX || "stx",
16
+ region: env.AWS_REGION || "us-east-1"
17
+ });
18
+ }
19
+ }
20
+ async function getAdapter() {
21
+ if (!_adapterPromise)
22
+ _adapterPromise = loadConfig();
23
+ return _adapterPromise;
24
+ }
25
+ export async function getAwsStorage() {
26
+ return getAdapter();
27
+ }
28
+ export const aws = {
29
+ async write(path, contents) {
30
+ await (await getAdapter()).write(path, contents);
31
+ },
32
+ async deleteFile(path) {
33
+ await (await getAdapter()).deleteFile(path);
34
+ },
35
+ async createDirectory(path) {
36
+ await (await getAdapter()).createDirectory(path);
37
+ },
38
+ async moveFile(from, to) {
39
+ await (await getAdapter()).moveFile(from, to);
40
+ },
41
+ async copyFile(from, to) {
42
+ await (await getAdapter()).copyFile(from, to);
43
+ },
44
+ async stat(path) {
45
+ return await (await getAdapter()).stat(path);
46
+ },
47
+ list(path, options = { deep: !1 }) {
48
+ return async function* () {
49
+ yield* (await getAdapter()).list(path, options);
50
+ }();
51
+ },
52
+ async changeVisibility(path, visibility) {
53
+ await (await getAdapter()).changeVisibility(path, visibility);
54
+ },
55
+ async visibility(path) {
56
+ return await (await getAdapter()).visibility(path);
57
+ },
58
+ async fileExists(path) {
59
+ return await (await getAdapter()).fileExists(path);
60
+ },
61
+ async directoryExists(path) {
62
+ return await (await getAdapter()).directoryExists(path);
63
+ },
64
+ async publicUrl(path, options) {
65
+ return await (await getAdapter()).publicUrl(path, options);
66
+ },
67
+ async temporaryUrl(path, options) {
68
+ return await (await getAdapter()).temporaryUrl(path, options);
69
+ },
70
+ async checksum(path, options) {
71
+ return await (await getAdapter()).checksum(path, options);
72
+ },
73
+ async mimeType(path, options) {
74
+ return await (await getAdapter()).mimeType(path, options);
75
+ },
76
+ async lastModified(path) {
77
+ return await (await getAdapter()).lastModified(path);
78
+ },
79
+ async fileSize(path) {
80
+ return await (await getAdapter()).fileSize(path);
81
+ },
82
+ async read(path) {
83
+ return await (await getAdapter()).read(path);
84
+ },
85
+ async readToString(path) {
86
+ return await (await getAdapter()).readToString(path);
87
+ },
88
+ async readToBuffer(path) {
89
+ return await (await getAdapter()).readToBuffer(path);
90
+ },
91
+ async readToUint8Array(path) {
92
+ return await (await getAdapter()).readToUint8Array(path);
93
+ }
94
+ };
@@ -0,0 +1,4 @@
1
+ import type { StorageAdapter } from '../types';
2
+ import type { StorageDriver } from '@stacksjs/types';
3
+ export declare function getBunStorage(): Promise<StorageAdapter>;
4
+ export declare const bun: StorageDriver;
@@ -0,0 +1,88 @@
1
+ import { resolve } from "node:path";
2
+ import process from "node:process";
3
+ import { createBunStorage } from "../adapters/bun";
4
+ let _adapterPromise = null;
5
+ async function loadConfig() {
6
+ try {
7
+ const { filesystems } = await import("@stacksjs/config"), rootDirectory = resolve(filesystems.root || process.cwd());
8
+ return createBunStorage({ root: rootDirectory });
9
+ } catch {
10
+ const rootDirectory = resolve(process.cwd());
11
+ return createBunStorage({ root: rootDirectory });
12
+ }
13
+ }
14
+ async function getAdapter() {
15
+ if (!_adapterPromise)
16
+ _adapterPromise = loadConfig();
17
+ return _adapterPromise;
18
+ }
19
+ export async function getBunStorage() {
20
+ return getAdapter();
21
+ }
22
+ export const bun = {
23
+ async write(path, contents) {
24
+ await (await getAdapter()).write(path, contents);
25
+ },
26
+ async deleteFile(path) {
27
+ await (await getAdapter()).deleteFile(path);
28
+ },
29
+ async createDirectory(path) {
30
+ await (await getAdapter()).createDirectory(path);
31
+ },
32
+ async moveFile(from, to) {
33
+ await (await getAdapter()).moveFile(from, to);
34
+ },
35
+ async copyFile(from, to) {
36
+ await (await getAdapter()).copyFile(from, to);
37
+ },
38
+ async stat(path) {
39
+ return await (await getAdapter()).stat(path);
40
+ },
41
+ list(path, options = { deep: !1 }) {
42
+ return async function* () {
43
+ yield* (await getAdapter()).list(path, options);
44
+ }();
45
+ },
46
+ async changeVisibility(path, visibility) {
47
+ await (await getAdapter()).changeVisibility(path, visibility);
48
+ },
49
+ async visibility(path) {
50
+ return await (await getAdapter()).visibility(path);
51
+ },
52
+ async fileExists(path) {
53
+ return await (await getAdapter()).fileExists(path);
54
+ },
55
+ async directoryExists(path) {
56
+ return await (await getAdapter()).directoryExists(path);
57
+ },
58
+ async publicUrl(path, options) {
59
+ return await (await getAdapter()).publicUrl(path, options);
60
+ },
61
+ async temporaryUrl(path, options) {
62
+ return await (await getAdapter()).temporaryUrl(path, options);
63
+ },
64
+ async checksum(path, options) {
65
+ return await (await getAdapter()).checksum(path, options);
66
+ },
67
+ async mimeType(path, options) {
68
+ return await (await getAdapter()).mimeType(path, options);
69
+ },
70
+ async lastModified(path) {
71
+ return await (await getAdapter()).lastModified(path);
72
+ },
73
+ async fileSize(path) {
74
+ return await (await getAdapter()).fileSize(path);
75
+ },
76
+ async read(path) {
77
+ return await (await getAdapter()).read(path);
78
+ },
79
+ async readToString(path) {
80
+ return await (await getAdapter()).readToString(path);
81
+ },
82
+ async readToBuffer(path) {
83
+ return await (await getAdapter()).readToBuffer(path);
84
+ },
85
+ async readToUint8Array(path) {
86
+ return await (await getAdapter()).readToUint8Array(path);
87
+ }
88
+ };
@@ -0,0 +1,4 @@
1
+ export * from './aws';
2
+ export * from './local';
3
+ export * from './memory';
4
+ export * from './bun';
@@ -0,0 +1,4 @@
1
+ export * from "./aws";
2
+ export * from "./local";
3
+ export * from "./memory";
4
+ export * from "./bun";
@@ -0,0 +1,4 @@
1
+ import type { StorageAdapter } from '../types';
2
+ import type { StorageDriver } from '@stacksjs/types';
3
+ export declare function getLocalStorage(): Promise<StorageAdapter>;
4
+ export declare const local: StorageDriver;
@@ -0,0 +1,88 @@
1
+ import { resolve } from "node:path";
2
+ import process from "node:process";
3
+ import { createLocalStorage } from "../adapters/local";
4
+ let _adapterPromise = null;
5
+ async function loadConfig() {
6
+ try {
7
+ const { filesystems } = await import("@stacksjs/config"), rootDirectory = resolve(filesystems.root || process.cwd());
8
+ return createLocalStorage({ root: rootDirectory });
9
+ } catch {
10
+ const rootDirectory = resolve(process.cwd());
11
+ return createLocalStorage({ root: rootDirectory });
12
+ }
13
+ }
14
+ async function getAdapter() {
15
+ if (!_adapterPromise)
16
+ _adapterPromise = loadConfig();
17
+ return _adapterPromise;
18
+ }
19
+ export async function getLocalStorage() {
20
+ return getAdapter();
21
+ }
22
+ export const local = {
23
+ async write(path, contents) {
24
+ await (await getAdapter()).write(path, contents);
25
+ },
26
+ async deleteFile(path) {
27
+ await (await getAdapter()).deleteFile(path);
28
+ },
29
+ async createDirectory(path) {
30
+ await (await getAdapter()).createDirectory(path);
31
+ },
32
+ async moveFile(from, to) {
33
+ await (await getAdapter()).moveFile(from, to);
34
+ },
35
+ async copyFile(from, to) {
36
+ await (await getAdapter()).copyFile(from, to);
37
+ },
38
+ async stat(path) {
39
+ return await (await getAdapter()).stat(path);
40
+ },
41
+ list(path, options = { deep: !1 }) {
42
+ return async function* () {
43
+ yield* (await getAdapter()).list(path, options);
44
+ }();
45
+ },
46
+ async changeVisibility(path, visibility) {
47
+ await (await getAdapter()).changeVisibility(path, visibility);
48
+ },
49
+ async visibility(path) {
50
+ return await (await getAdapter()).visibility(path);
51
+ },
52
+ async fileExists(path) {
53
+ return await (await getAdapter()).fileExists(path);
54
+ },
55
+ async directoryExists(path) {
56
+ return await (await getAdapter()).directoryExists(path);
57
+ },
58
+ async publicUrl(path, options) {
59
+ return await (await getAdapter()).publicUrl(path, options);
60
+ },
61
+ async temporaryUrl(path, options) {
62
+ return await (await getAdapter()).temporaryUrl(path, options);
63
+ },
64
+ async checksum(path, options) {
65
+ return await (await getAdapter()).checksum(path, options);
66
+ },
67
+ async mimeType(path, options) {
68
+ return await (await getAdapter()).mimeType(path, options);
69
+ },
70
+ async lastModified(path) {
71
+ return await (await getAdapter()).lastModified(path);
72
+ },
73
+ async fileSize(path) {
74
+ return await (await getAdapter()).fileSize(path);
75
+ },
76
+ async read(path) {
77
+ return await (await getAdapter()).read(path);
78
+ },
79
+ async readToString(path) {
80
+ return await (await getAdapter()).readToString(path);
81
+ },
82
+ async readToBuffer(path) {
83
+ return await (await getAdapter()).readToBuffer(path);
84
+ },
85
+ async readToUint8Array(path) {
86
+ return await (await getAdapter()).readToUint8Array(path);
87
+ }
88
+ };
@@ -0,0 +1,4 @@
1
+ import type { StorageDriver } from '@stacksjs/types';
2
+ declare const adapter: unknown;
3
+ export declare const memoryStorage: unknown;
4
+ export declare const memory: StorageDriver;
@@ -0,0 +1,67 @@
1
+ import { createMemoryStorage } from "../adapters/memory";
2
+ const adapter = createMemoryStorage();
3
+ export const memoryStorage = adapter, memory = {
4
+ async write(path, contents) {
5
+ await adapter.write(path, contents);
6
+ },
7
+ async deleteFile(path) {
8
+ await adapter.deleteFile(path);
9
+ },
10
+ async createDirectory(path) {
11
+ await adapter.createDirectory(path);
12
+ },
13
+ async moveFile(from, to) {
14
+ await adapter.moveFile(from, to);
15
+ },
16
+ async copyFile(from, to) {
17
+ await adapter.copyFile(from, to);
18
+ },
19
+ async stat(path) {
20
+ return await adapter.stat(path);
21
+ },
22
+ list(path, options = { deep: !1 }) {
23
+ return adapter.list(path, options);
24
+ },
25
+ async changeVisibility(path, visibility) {
26
+ await adapter.changeVisibility(path, visibility);
27
+ },
28
+ async visibility(path) {
29
+ return await adapter.visibility(path);
30
+ },
31
+ async fileExists(path) {
32
+ return await adapter.fileExists(path);
33
+ },
34
+ async directoryExists(path) {
35
+ return await adapter.directoryExists(path);
36
+ },
37
+ async publicUrl(path, options) {
38
+ return await adapter.publicUrl(path, options);
39
+ },
40
+ async temporaryUrl(path, options) {
41
+ return await adapter.temporaryUrl(path, options);
42
+ },
43
+ async checksum(path, options) {
44
+ return await adapter.checksum(path, options);
45
+ },
46
+ async mimeType(path, options) {
47
+ return await adapter.mimeType(path, options);
48
+ },
49
+ async lastModified(path) {
50
+ return await adapter.lastModified(path);
51
+ },
52
+ async fileSize(path) {
53
+ return await adapter.fileSize(path);
54
+ },
55
+ async read(path) {
56
+ return await adapter.read(path);
57
+ },
58
+ async readToString(path) {
59
+ return await adapter.readToString(path);
60
+ },
61
+ async readToBuffer(path) {
62
+ return await adapter.readToBuffer(path);
63
+ },
64
+ async readToUint8Array(path) {
65
+ return await adapter.readToUint8Array(path);
66
+ }
67
+ };
@@ -0,0 +1,53 @@
1
+ import type { DiskConfig, DiskName, FilesystemConfig, LocalDiskConfig, S3DiskConfig } from './types/filesystem';
2
+ import type { GetStreamOptions, PresignedUploadPolicy, PresignedUploadPolicyOptions, PresignedUploadUrl, PresignedUploadUrlOptions, PutResult, PutStreamOptions, SignedUrlOptions, StatEntry, StorageAdapter } from './types';
3
+ import type { PutFileOptions, UploadedFileLike } from './put-file';
4
+ export type {
5
+ DiskConfig,
6
+ FilesystemConfig,
7
+ LocalDiskConfig,
8
+ S3DiskConfig,
9
+ } from './types/filesystem';
10
+ // =============================================================================
11
+ // Exports
12
+ // =============================================================================
13
+ export declare const Storage: StorageManager;
14
+ // =============================================================================
15
+ // Storage Manager
16
+ // =============================================================================
17
+ declare class StorageManager {
18
+ init(config: Partial<FilesystemConfig>): this;
19
+ disk(name?: DiskName): StorageAdapter;
20
+ put(path: string, contents: string | Uint8Array | Buffer): Promise<PutResult>;
21
+ put(file: UploadedFileLike, opts?: PutFileOptions): Promise<PutResult & { url: string }>;
22
+ put(pathOrFile: string | UploadedFileLike, contentsOrOpts?: string | Uint8Array | Buffer | PutFileOptions): Promise<PutResult | (PutResult & { url: string })>;
23
+ stat(path: string): Promise<StatEntry>;
24
+ getStream(path: string, options?: GetStreamOptions): Promise<ReadableStream<Uint8Array>>;
25
+ putStream(path: string, stream: ReadableStream<Uint8Array>, options?: PutStreamOptions): Promise<PutResult>;
26
+ copyAcross(source: string, dest: string): Promise<PutResult>;
27
+ moveAcross(source: string, dest: string): Promise<PutResult>;
28
+ get(path: string): Promise<string>;
29
+ exists(path: string): Promise<boolean>;
30
+ missing(path: string): Promise<boolean>;
31
+ delete(path: string): Promise<void>;
32
+ copy(from: string, to: string): Promise<void>;
33
+ move(from: string, to: string): Promise<void>;
34
+ url(path: string): Promise<string>;
35
+ signedUrl(path: string, options: SignedUrlOptions): Promise<string>;
36
+ presignedUploadUrl(options: PresignedUploadUrlOptions): Promise<PresignedUploadUrl>;
37
+ presignedUploadPolicy(options: PresignedUploadPolicyOptions): Promise<PresignedUploadPolicy>;
38
+ size(path: string): Promise<number>;
39
+ lastModified(path: string): Promise<number>;
40
+ mimeType(path: string): Promise<string>;
41
+ checksum(path: string, algorithm?: 'md5' | 'sha1' | 'sha256'): Promise<string>;
42
+ makeDirectory(path: string): Promise<void>;
43
+ deleteDirectory(path: string): Promise<void>;
44
+ files(path?: string): AsyncIterable<{ path: string; type: 'file' | 'directory' }>;
45
+ allFiles(path?: string): AsyncIterable<{ path: string; type: 'file' | 'directory' }>;
46
+ configure(name: string, config: DiskConfig): this;
47
+ setDefaultDisk(name: string): this;
48
+ getDiskConfig(name?: string): DiskConfig | undefined;
49
+ getConfiguredDisks(): string[];
50
+ getDefaultDisk(): string;
51
+ reset(): this;
52
+ }
53
+ export { StorageManager };