UNPKG

@eleven-am/transcoder

Version:

High-performance HLS transcoding library with hardware acceleration, intelligent client management, and distributed processing support for Node.js

66 lines 2.54 kB
import * as fs from 'fs'; import { TaskEither } from '@eleven-am/fp'; export declare class FileStorage { private readonly cacheDirectory; constructor(cacheDirectory: string); /** * Generates a unique file ID based on the file's inode number. * @param filePath The path to the file. * @returns A TaskEither containing the generated file ID or an error. */ generateFileId(filePath: string): TaskEither<string>; /** * Deletes a file at the specified path. * @param path The path to the file to delete. * @returns A TaskEither indicating success or failure. */ deleteFile(path: string): TaskEither<void>; /** * Deletes all files with a specified prefix. * @param prefix The prefix to match files against. * @returns A TaskEither indicating success or failure. */ deleteFilesWithPrefix(prefix: string): TaskEither<void>; /** * Checks if a file exists at the specified path. * @param path The path to check. * @returns A TaskEither containing true if the file exists, false otherwise. */ exists(path: string): TaskEither<boolean>; /** * Gets the base path for a given file ID. * @param fileId The file ID. * @returns The base path for the file ID. */ getBasePath(fileId: string): string; /** * Gets a media source for a file at the specified path. * @param filePath The path to the file. * @returns A MediaSource object for the file. */ getFileStream(filePath: string): TaskEither<fs.ReadStream>; /** * Lists all files that begin with the given prefix. * @param prefix The path prefix to search for. */ listFiles(prefix: string): TaskEither<string[]>; /** * Saves data from a readable stream to storage. * @param filePath The destination path. * @param content The readable stream containing the data to save. */ saveFile(filePath: string, content: NodeJS.ReadableStream): TaskEither<void>; /** * Gets the size of a file in bytes. * @param path The path to the file. * @returns A TaskEither containing the file size or an error. */ getFileSize(path: string): TaskEither<number>; /** * Ensures that the directory for a given path exists. * @param path The path of the directory to check. * @returns A TaskEither containing the path if successful, or an error. */ ensureDirectoryExists(path: string): TaskEither<string>; } //# sourceMappingURL=fileStorage.d.ts.map