fix(core): update
This commit is contained in:
parent
4b70edb947
commit
7245b49c31
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartbucket',
|
name: '@push.rocks/smartbucket',
|
||||||
version: '3.0.13',
|
version: '3.0.14',
|
||||||
description: 'A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.'
|
description: 'A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.'
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,10 @@ export class Directory {
|
|||||||
});
|
});
|
||||||
if (!exists && optionsArg.getFromTrash) {
|
if (!exists && optionsArg.getFromTrash) {
|
||||||
const trash = await this.bucketRef.getTrash();
|
const trash = await this.bucketRef.getTrash();
|
||||||
const trashKey = await trash.getTrashKeyByOriginalBasePath()
|
const trashedFile = await trash.getTrashedFileByOriginalName(
|
||||||
|
pathDescriptor
|
||||||
|
)
|
||||||
|
return trashedFile;
|
||||||
}
|
}
|
||||||
if (!exists && !optionsArg.createWithContents) {
|
if (!exists && !optionsArg.createWithContents) {
|
||||||
return null;
|
return null;
|
||||||
@ -94,7 +97,7 @@ export class Directory {
|
|||||||
return new File({
|
return new File({
|
||||||
directoryRefArg: this,
|
directoryRefArg: this,
|
||||||
fileName: optionsArg.name,
|
fileName: optionsArg.name,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +135,7 @@ export class Directory {
|
|||||||
},
|
},
|
||||||
finalFunction: async (tools) => {
|
finalFunction: async (tools) => {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
fileNameStream.pipe(duplexStream);
|
fileNameStream.pipe(duplexStream);
|
||||||
await done.promise;
|
await done.promise;
|
||||||
@ -171,7 +174,7 @@ export class Directory {
|
|||||||
},
|
},
|
||||||
finalFunction: async (tools) => {
|
finalFunction: async (tools) => {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
completeDirStream.pipe(duplexStream);
|
completeDirStream.pipe(duplexStream);
|
||||||
await done.promise;
|
await done.promise;
|
||||||
@ -246,23 +249,35 @@ export class Directory {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public fastGetStream(optionsArg: {
|
public fastGetStream(
|
||||||
path: string;
|
optionsArg: {
|
||||||
}, typeArg: 'webstream'): Promise<ReadableStream>
|
path: string;
|
||||||
public async fastGetStream(optionsArg: {
|
},
|
||||||
path: string;
|
typeArg: 'webstream'
|
||||||
}, typeArg: 'nodestream'): Promise<plugins.stream.Readable>
|
): Promise<ReadableStream>;
|
||||||
|
public async fastGetStream(
|
||||||
|
optionsArg: {
|
||||||
|
path: string;
|
||||||
|
},
|
||||||
|
typeArg: 'nodestream'
|
||||||
|
): Promise<plugins.stream.Readable>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fastGetStream
|
* fastGetStream
|
||||||
* @param optionsArg
|
* @param optionsArg
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
public async fastGetStream(optionsArg: { path: string; }, typeArg: 'webstream' | 'nodestream'): Promise<ReadableStream | plugins.stream.Readable>{
|
public async fastGetStream(
|
||||||
|
optionsArg: { path: string },
|
||||||
|
typeArg: 'webstream' | 'nodestream'
|
||||||
|
): Promise<ReadableStream | plugins.stream.Readable> {
|
||||||
const path = plugins.path.join(this.getBasePath(), optionsArg.path);
|
const path = plugins.path.join(this.getBasePath(), optionsArg.path);
|
||||||
const result = await this.bucketRef.fastGetStream({
|
const result = await this.bucketRef.fastGetStream(
|
||||||
path
|
{
|
||||||
}, typeArg as any);
|
path,
|
||||||
|
},
|
||||||
|
typeArg as any
|
||||||
|
);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,10 @@ export class Trash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async getTrashedFileByOriginalName(pathDescriptor: interfaces.IPathDecriptor): Promise<File> {
|
public async getTrashedFileByOriginalName(pathDescriptor: interfaces.IPathDecriptor): Promise<File> {
|
||||||
|
const trashDir = await this.getTrashDir();
|
||||||
|
const originalPath = await helpers.reducePathDescriptorToPath(pathDescriptor);
|
||||||
|
const trashKey = await this.getTrashKeyByOriginalBasePath(originalPath);
|
||||||
|
return trashDir.getFile({ name: trashKey });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getTrashKeyByOriginalBasePath (originalPath: string): Promise<string> {
|
public async getTrashKeyByOriginalBasePath (originalPath: string): Promise<string> {
|
||||||
|
Loading…
Reference in New Issue
Block a user