@becomes/cms-cloud-client
Version:
SDK for accessing BCMS Cloud API
40 lines (39 loc) • 1.28 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { S3Client } from '@aws-sdk/client-s3';
import type { Readable } from 'stream';
export type MediaBaseType = 'log' | 'public' | 'instance-code' | 'plugin' | 'instance-fje' | 'instance-addition-files';
export declare class MediaService {
static readonly defaultType = "public";
static readonly logger: import("@becomes/purple-cheetah").Logger;
static readonly s3: S3Client | null;
static readonly fs: import("@banez/fs/types").FS;
static streamToBuffer(stream: Readable): Promise<Buffer>;
static save({ type, path, data, mimetype, name, }: {
type?: MediaBaseType;
path: string;
data: Buffer;
mimetype: string;
name: string;
}): Promise<void>;
static read({ type, path, }: {
path: string;
type?: MediaBaseType;
}): Promise<{
data: Buffer;
mimetype: string;
name: string;
} | null>;
static readStream({ type, path, }: {
type?: MediaBaseType;
path: string;
}): Promise<{
stream: Readable;
mimetype: string;
name: string;
} | null>;
static remove({ type, path, }: {
type?: MediaBaseType;
path: string;
}): Promise<void>;
}