Compare commits

..

4 Commits

Author SHA1 Message Date
4819dd0bc5 1.0.29 2020-05-17 19:23:27 +00:00
7250793f95 fix(core): update 2020-05-17 19:23:26 +00:00
8fb5e89714 1.0.28 2020-05-17 16:19:17 +00:00
9dbd19d1a9 fix(core): update 2020-05-17 16:19:16 +00:00
4 changed files with 26 additions and 10 deletions

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartbucket",
"version": "1.0.27",
"version": "1.0.29",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1179,9 +1179,9 @@
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"minio": {
"version": "7.0.12",
"resolved": "https://verdaccio.lossless.one/minio/-/minio-7.0.12.tgz",
"integrity": "sha512-mTa8bc2X1vcKwbzvNMNk/DHkuSrlfjlG3aA8IA1qihlH73XbwiloX/6skCabmDvrmmt6cx6pytaBJZmp4OMwnw==",
"version": "7.0.16",
"resolved": "https://verdaccio.lossless.one/minio/-/minio-7.0.16.tgz",
"integrity": "sha512-OgCJ3XVMzukSqoMFBiBDeyz30BxYTBM9yRLVRBCExTb+QKVxJh4DnUOS2/zw7OPeDyXXEvYSzDvg4FkCf1Cxyw==",
"requires": {
"async": "^3.1.0",
"block-stream2": "^2.0.0",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartbucket",
"version": "1.0.27",
"version": "1.0.29",
"description": "simple cloud independent object storage",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -25,7 +25,7 @@
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/streamfunction": "^1.0.24",
"@types/minio": "^7.0.5",
"minio": "7.0.12"
"minio": "^7.0.16"
},
"private": false,
"files": [

View File

@ -76,6 +76,14 @@ tap.test('should correctly build paths for sub directories', async () => {
console.log(dir4BasePath);
});
tap.test('should list huge file directory', async () => {
const servezoneBucket = await smartbucket.Bucket.getBucketByName(testSmartbucket, 'servezone');
const servezoneBaseDirectory = await servezoneBucket.getBaseDirectory();
this.brandfileDirectory = await servezoneBaseDirectory.getSubDirectoryByName('brandfiles');
const files = servezoneBaseDirectory.listFiles();
console.log(files)
});
tap.test('clean up directory style tests', async () => {
await myBucket.fastRemove('dir1/file1.txt');
await myBucket.fastRemove('dir1/file2.txt');

View File

@ -44,7 +44,7 @@ export class Directory {
let basePath = '';
for (const parentDir of parentDirectories) {
if (parentDir.name === '') {
basePath = this.name;
basePath = this.name + '/';
continue;
}
basePath = parentDir.name + '/' + this.name;
@ -59,11 +59,15 @@ export class Directory {
const done = plugins.smartpromise.defer();
const fileNameStream = await this.bucketRef.smartbucketRef.minioClient.listObjectsV2(
this.bucketRef.name,
this.getBasePath()
this.getBasePath(),
false
);
const fileArray: File[] = [];
const duplexStream = plugins.streamfunction.createDuplexStream<plugins.minio.BucketItem, void>(
async bucketItem => {
if (bucketItem.prefix) {
return;
}
if (!bucketItem.name) {
return;
}
@ -89,15 +93,19 @@ export class Directory {
*/
public async listDirectories(): Promise<Directory[]> {
const done = plugins.smartpromise.defer();
const basePath = this.getBasePath();
const completeDirStream = await this.bucketRef.smartbucketRef.minioClient.listObjectsV2(
this.bucketRef.name,
this.getBasePath(),
true
false
);
const directoryArray: Directory[] = [];
const duplexStream = plugins.streamfunction.createDuplexStream<plugins.minio.BucketItem, void>(
async bucketItem => {
let subtractedPath = bucketItem.name.replace(this.getBasePath(), '');
if (bucketItem.name) {
return;
}
let subtractedPath = bucketItem.prefix.replace(this.getBasePath(), '');
if (subtractedPath.startsWith('/')) {
subtractedPath = subtractedPath.substr(1);
}