@naturalcycles/cloud-storage-lib 1.0.0 → 1.0.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.
|
@@ -29,4 +29,5 @@ export declare class CommonStorageKeyValueDB implements CommonKeyValueDB {
|
|
|
29
29
|
streamIds(table: string, limit?: number): ReadableTyped<string>;
|
|
30
30
|
streamValues(table: string, limit?: number): ReadableTyped<Buffer>;
|
|
31
31
|
streamEntries(table: string, limit?: number): ReadableTyped<KeyValueDBTuple>;
|
|
32
|
+
count(table: string): Promise<number>;
|
|
32
33
|
}
|
|
@@ -83,5 +83,9 @@ class CommonStorageKeyValueDB {
|
|
|
83
83
|
content,
|
|
84
84
|
]));
|
|
85
85
|
}
|
|
86
|
+
async count(table) {
|
|
87
|
+
const { bucketName, prefix } = this.getBucketAndPrefix(table);
|
|
88
|
+
return (await this.cfg.storage.getFileNames(bucketName, prefix)).length;
|
|
89
|
+
}
|
|
86
90
|
}
|
|
87
91
|
exports.CommonStorageKeyValueDB = CommonStorageKeyValueDB;
|
package/package.json
CHANGED
|
@@ -106,4 +106,10 @@ export class CommonStorageKeyValueDB implements CommonKeyValueDB {
|
|
|
106
106
|
]),
|
|
107
107
|
)
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
async count(table: string): Promise<number> {
|
|
111
|
+
const { bucketName, prefix } = this.getBucketAndPrefix(table)
|
|
112
|
+
|
|
113
|
+
return (await this.cfg.storage.getFileNames(bucketName, prefix)).length
|
|
114
|
+
}
|
|
109
115
|
}
|