@naturalcycles/cloud-storage-lib 1.5.2 → 1.5.3
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/commonStorage.d.ts +14 -14
- package/package.json +2 -2
- package/src/commonStorage.ts +24 -14
package/dist/commonStorage.d.ts
CHANGED
|
@@ -40,18 +40,18 @@ export interface CommonStorage {
|
|
|
40
40
|
*
|
|
41
41
|
* Pass `bucketName` in case you only have permissions to operate on that bucket.
|
|
42
42
|
*/
|
|
43
|
-
ping(bucketName?: string)
|
|
43
|
+
ping: (bucketName?: string) => Promise<void>;
|
|
44
44
|
/**
|
|
45
45
|
* Creates a new bucket by given name.
|
|
46
46
|
* todo: check what to do if it already exists
|
|
47
47
|
*/
|
|
48
|
-
fileExists(bucketName: string, filePath: string)
|
|
49
|
-
getFile(bucketName: string, filePath: string)
|
|
50
|
-
saveFile(bucketName: string, filePath: string, content: Buffer)
|
|
48
|
+
fileExists: (bucketName: string, filePath: string) => Promise<boolean>;
|
|
49
|
+
getFile: (bucketName: string, filePath: string) => Promise<Buffer | null>;
|
|
50
|
+
saveFile: (bucketName: string, filePath: string, content: Buffer) => Promise<void>;
|
|
51
51
|
/**
|
|
52
52
|
* Should recursively delete all files in a folder, if path is a folder.
|
|
53
53
|
*/
|
|
54
|
-
deletePath(bucketName: string, prefix: string)
|
|
54
|
+
deletePath: (bucketName: string, prefix: string) => Promise<void>;
|
|
55
55
|
/**
|
|
56
56
|
* Returns an array of strings which are file paths.
|
|
57
57
|
* Files that are not found by the path are not present in the map.
|
|
@@ -63,13 +63,13 @@ export interface CommonStorage {
|
|
|
63
63
|
* Important difference between `prefix` and `path` is that `prefix` will
|
|
64
64
|
* return all files from sub-directories too!
|
|
65
65
|
*/
|
|
66
|
-
getFileNames(bucketName: string, opt?: CommonStorageGetOptions)
|
|
67
|
-
getFileNamesStream(bucketName: string, opt?: CommonStorageGetOptions)
|
|
68
|
-
getFilesStream(bucketName: string, opt?: CommonStorageGetOptions)
|
|
69
|
-
getFileReadStream(bucketName: string, filePath: string)
|
|
70
|
-
getFileWriteStream(bucketName: string, filePath: string)
|
|
71
|
-
setFileVisibility(bucketName: string, filePath: string, isPublic: boolean)
|
|
72
|
-
getFileVisibility(bucketName: string, filePath: string)
|
|
73
|
-
copyFile(fromBucket: string, fromPath: string, toPath: string, toBucket?: string)
|
|
74
|
-
moveFile(fromBucket: string, fromPath: string, toPath: string, toBucket?: string)
|
|
66
|
+
getFileNames: (bucketName: string, opt?: CommonStorageGetOptions) => Promise<string[]>;
|
|
67
|
+
getFileNamesStream: (bucketName: string, opt?: CommonStorageGetOptions) => ReadableTyped<string>;
|
|
68
|
+
getFilesStream: (bucketName: string, opt?: CommonStorageGetOptions) => ReadableTyped<FileEntry>;
|
|
69
|
+
getFileReadStream: (bucketName: string, filePath: string) => Readable;
|
|
70
|
+
getFileWriteStream: (bucketName: string, filePath: string) => Writable;
|
|
71
|
+
setFileVisibility: (bucketName: string, filePath: string, isPublic: boolean) => Promise<void>;
|
|
72
|
+
getFileVisibility: (bucketName: string, filePath: string) => Promise<boolean>;
|
|
73
|
+
copyFile: (fromBucket: string, fromPath: string, toPath: string, toBucket?: string) => Promise<void>;
|
|
74
|
+
moveFile: (fromBucket: string, fromPath: string, toPath: string, toBucket?: string) => Promise<void>;
|
|
75
75
|
}
|
package/package.json
CHANGED
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"url": "https://github.com/NaturalCycles/cloud-storage-lib"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": ">=18.12.0"
|
|
37
37
|
},
|
|
38
|
-
"version": "1.5.
|
|
38
|
+
"version": "1.5.3",
|
|
39
39
|
"description": "",
|
|
40
40
|
"author": "Natural Cycles Team",
|
|
41
41
|
"license": "MIT"
|
package/src/commonStorage.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface CommonStorage {
|
|
|
45
45
|
*
|
|
46
46
|
* Pass `bucketName` in case you only have permissions to operate on that bucket.
|
|
47
47
|
*/
|
|
48
|
-
ping(bucketName?: string)
|
|
48
|
+
ping: (bucketName?: string) => Promise<void>
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Creates a new bucket by given name.
|
|
@@ -53,16 +53,16 @@ export interface CommonStorage {
|
|
|
53
53
|
*/
|
|
54
54
|
// createBucket(bucketName: string): Promise<void>
|
|
55
55
|
|
|
56
|
-
fileExists(bucketName: string, filePath: string)
|
|
56
|
+
fileExists: (bucketName: string, filePath: string) => Promise<boolean>
|
|
57
57
|
|
|
58
|
-
getFile(bucketName: string, filePath: string)
|
|
58
|
+
getFile: (bucketName: string, filePath: string) => Promise<Buffer | null>
|
|
59
59
|
|
|
60
|
-
saveFile(bucketName: string, filePath: string, content: Buffer)
|
|
60
|
+
saveFile: (bucketName: string, filePath: string, content: Buffer) => Promise<void>
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Should recursively delete all files in a folder, if path is a folder.
|
|
64
64
|
*/
|
|
65
|
-
deletePath(bucketName: string, prefix: string)
|
|
65
|
+
deletePath: (bucketName: string, prefix: string) => Promise<void>
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Returns an array of strings which are file paths.
|
|
@@ -75,20 +75,30 @@ export interface CommonStorage {
|
|
|
75
75
|
* Important difference between `prefix` and `path` is that `prefix` will
|
|
76
76
|
* return all files from sub-directories too!
|
|
77
77
|
*/
|
|
78
|
-
getFileNames(bucketName: string, opt?: CommonStorageGetOptions)
|
|
78
|
+
getFileNames: (bucketName: string, opt?: CommonStorageGetOptions) => Promise<string[]>
|
|
79
79
|
|
|
80
|
-
getFileNamesStream(bucketName: string, opt?: CommonStorageGetOptions)
|
|
80
|
+
getFileNamesStream: (bucketName: string, opt?: CommonStorageGetOptions) => ReadableTyped<string>
|
|
81
81
|
|
|
82
|
-
getFilesStream(bucketName: string, opt?: CommonStorageGetOptions)
|
|
82
|
+
getFilesStream: (bucketName: string, opt?: CommonStorageGetOptions) => ReadableTyped<FileEntry>
|
|
83
83
|
|
|
84
|
-
getFileReadStream(bucketName: string, filePath: string)
|
|
84
|
+
getFileReadStream: (bucketName: string, filePath: string) => Readable
|
|
85
85
|
|
|
86
|
-
getFileWriteStream(bucketName: string, filePath: string)
|
|
86
|
+
getFileWriteStream: (bucketName: string, filePath: string) => Writable
|
|
87
87
|
|
|
88
|
-
setFileVisibility(bucketName: string, filePath: string, isPublic: boolean)
|
|
88
|
+
setFileVisibility: (bucketName: string, filePath: string, isPublic: boolean) => Promise<void>
|
|
89
89
|
|
|
90
|
-
getFileVisibility(bucketName: string, filePath: string)
|
|
90
|
+
getFileVisibility: (bucketName: string, filePath: string) => Promise<boolean>
|
|
91
91
|
|
|
92
|
-
copyFile
|
|
93
|
-
|
|
92
|
+
copyFile: (
|
|
93
|
+
fromBucket: string,
|
|
94
|
+
fromPath: string,
|
|
95
|
+
toPath: string,
|
|
96
|
+
toBucket?: string,
|
|
97
|
+
) => Promise<void>
|
|
98
|
+
moveFile: (
|
|
99
|
+
fromBucket: string,
|
|
100
|
+
fromPath: string,
|
|
101
|
+
toPath: string,
|
|
102
|
+
toBucket?: string,
|
|
103
|
+
) => Promise<void>
|
|
94
104
|
}
|