finish trash
This commit is contained in:
@@ -2,6 +2,8 @@ import * as plugins from './plugins.js';
|
||||
import { Bucket } from './classes.bucket.js';
|
||||
import { File } from './classes.file.js';
|
||||
|
||||
import * as helpers from './helpers.js';
|
||||
|
||||
export class Directory {
|
||||
public bucketRef: Bucket;
|
||||
public parentDirectoryRef: Directory;
|
||||
@@ -65,11 +67,20 @@ export class Directory {
|
||||
public async getFile(optionsArg: {
|
||||
name: string;
|
||||
createWithContents?: string | Buffer;
|
||||
getFromTrash?: boolean;
|
||||
}): Promise<File> {
|
||||
const pathDescriptor = {
|
||||
directory: this,
|
||||
path: optionsArg.name,
|
||||
};
|
||||
// check wether the file exists
|
||||
const exists = await this.bucketRef.fastExists({
|
||||
path: this.getBasePath() + optionsArg.name,
|
||||
path: await helpers.reducePathDescriptorToPath(pathDescriptor),
|
||||
});
|
||||
if (!exists && optionsArg.getFromTrash) {
|
||||
const trash = await this.bucketRef.getTrash();
|
||||
const trashKey = await trash.getTrashKeyByOriginalBasePath()
|
||||
}
|
||||
if (!exists && !optionsArg.createWithContents) {
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user