Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9ad70a9942 | |||
bc41089925 | |||
ab39809c2a | |||
cede6c7539 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartbucket",
|
"name": "@pushrocks/smartbucket",
|
||||||
"version": "1.0.19",
|
"version": "1.0.21",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartbucket",
|
"name": "@pushrocks/smartbucket",
|
||||||
"version": "1.0.19",
|
"version": "1.0.21",
|
||||||
"description": "simple cloud independent object storage",
|
"description": "simple cloud independent object storage",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -67,6 +67,13 @@ tap.test('should get base directory', async () => {
|
|||||||
expect(files.length).to.equal(1);
|
expect(files.length).to.equal(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should correctly build paths for sub directories', async () => {
|
||||||
|
const dir1 = await baseDirectory.getSubDirectoryByName('dir1');
|
||||||
|
expect(dir1).to.be.instanceOf(smartbucket.Directory);
|
||||||
|
const dir1BasePath = dir1.getBasePath();
|
||||||
|
console.log(dir1BasePath);
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('clean up directory style tests', async () => {
|
tap.test('clean up directory style tests', async () => {
|
||||||
await myBucket.fastRemove('dir1/file1.txt');
|
await myBucket.fastRemove('dir1/file1.txt');
|
||||||
await myBucket.fastRemove('dir1/file2.txt');
|
await myBucket.fastRemove('dir1/file2.txt');
|
||||||
|
@ -43,7 +43,7 @@ export class Directory {
|
|||||||
const parentDirectories = this.getParentDirectories();
|
const parentDirectories = this.getParentDirectories();
|
||||||
let basePath = '';
|
let basePath = '';
|
||||||
for (const parentDir of parentDirectories) {
|
for (const parentDir of parentDirectories) {
|
||||||
basePath = parentDir.name + '/' + basePath;
|
basePath = parentDir.name + '/' + this.name;
|
||||||
}
|
}
|
||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,8 @@ export class Directory {
|
|||||||
|
|
||||||
public async fastGet(pathArg: string) {
|
public async fastGet(pathArg: string) {
|
||||||
const path = plugins.path.join(this.getBasePath(), pathArg);
|
const path = plugins.path.join(this.getBasePath(), pathArg);
|
||||||
await this.bucketRef.fastGet(path);
|
const result = await this.bucketRef.fastGet(path);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async fastRemove(pathArg: string) {
|
public async fastRemove(pathArg: string) {
|
||||||
|
Reference in New Issue
Block a user