Skip to main content
Glama
storageService.ts2.45 kB
import { Unit } from '../types/index.js'; /** * Абстрактный интерфейс для работы с хранилищем данных * Может быть реализован для файловой системы, удаленного сервера, терминала и т.д. */ export abstract class StorageService { /** * Читает полное содержимое файла/ресурса */ abstract readContent(resource: string): Promise<string>; /** * Записывает содержимое в файл/ресурс */ abstract writeContent(resource: string, content: string): Promise<void>; /** * Проверяет существование файла/ресурса */ abstract resourceExists(resource: string): Promise<boolean>; /** * Извлекает фрагмент содержимого из файла/ресурса */ abstract extractContent(resource: string, position: number, count: number, unit: Unit): Promise<string>; /** * Вставляет содержимое в файл/ресурс */ abstract insertContent( resource: string, position: number, content: string, replaceCount?: number, unit?: Unit ): Promise<void>; /** * Удаляет содержимое из файла/ресурса */ abstract removeContent(resource: string, position: number, count: number, unit: Unit): Promise<void>; /** * Создает резервную копию содержимого (для операций cut) */ abstract createBackup?(resource: string): Promise<string>; /** * Восстанавливает из резервной копии */ abstract restoreBackup?(resource: string, backupId: string): Promise<void>; /** * Извлекает содержимое по pattern */ abstract extractContentByPattern(resource: string, startPattern: string, endPattern?: string, lineCount?: number): Promise<string>; /** * Вставляет содержимое по marker */ abstract insertContentByMarker(resource: string, marker: string, content: string, position: 'before' | 'after' | 'replace', replacePattern?: string): Promise<void>; /** * Удаляет содержимое по pattern */ abstract removeContentByPattern(resource: string, startPattern: string, endPattern?: string, lineCount?: number): Promise<void>; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/witqq/clipboard-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server