@push.rocks/smartbucket
Version:
A TypeScript library providing a cloud-agnostic interface for managing object storage with functionalities like bucket management, file and directory operations, and advanced features such as metadata handling and file locking.
69 lines (68 loc) • 2.12 kB
TypeScript
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import * as plugins from './smartbucket.plugins.js';
import { SmartBucket } from './smartbucket.classes.smartbucket.js';
import { Directory } from './smartbucket.classes.directory.js';
export declare class Bucket {
static getBucketByName(smartbucketRef: SmartBucket, bucketNameArg: string): Promise<Bucket>;
static createBucketByName(smartbucketRef: SmartBucket, bucketName: string): Promise<Bucket>;
static removeBucketByName(smartbucketRef: SmartBucket, bucketName: string): Promise<void>;
smartbucketRef: SmartBucket;
name: string;
constructor(smartbucketRef: SmartBucket, bucketName: string);
/**
* gets the base directory of the bucket
*/
getBaseDirectory(): Promise<Directory>;
/**
* store file
*/
fastPut(optionsArg: {
path: string;
contents: string | Buffer;
}): Promise<void>;
/**
* get file
*/
fastGet(optionsArg: Parameters<typeof this.fastGetStream>[0]): Promise<Buffer>;
fastGetStream(optionsArg: {
path: string;
}): Promise<plugins.smartrx.rxjs.ReplaySubject<Buffer>>;
/**
* store file as stream
*/
fastPutStream(optionsArg: {
path: string;
dataStream: plugins.stream.Readable;
nativeMetadata?: {
[key: string]: string;
};
}): Promise<void>;
copyObject(optionsArg: {
/**
* the
*/
objectKey: string;
/**
* in case you want to copy to another bucket specify it here
*/
targetBucket?: Bucket;
targetBucketKey?: string;
/**
* metadata will be merged with existing metadata
*/
nativeMetadata?: {
[key: string]: string;
};
deleteExistingNativeMetadata?: boolean;
}): Promise<void>;
/**
* removeObject
*/
fastRemove(optionsArg: {
path: string;
}): Promise<void>;
doesObjectExist(optionsArg: {
path: string;
}): Promise<boolean>;
}