JavaScript Helpers
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
The StudioCMS Storage API provides several JavaScript helpers to facilitate interaction with storage backends. These helpers simplify tasks such as resolving storage identifiers and keys, as well as providing type definitions for better type safety and code completion.
JavaScript helpers
Section titled “JavaScript helpers”import { resolveStorageIdentifier, resolveStorageKey,} from 'studiocms/storage-api';
const storageIdentifier = await resolveStorageIdentifier('storage-file://my-file.txt', { baseUrl: 'https://example.com/', // Use the value of `site` from "astro:config/server"});
const storageKey = await resolveStorageKey('my-file.txt', { baseUrl: 'https://example.com/', // Use the value of `site` from "astro:config/server"});JavaScript Types
Section titled “JavaScript Types”import type { ContextJsonBody, AuthorizationType, ParsedContext, UrlMetadata, UrlMapping, ContextHandler, ContextHandlerFn, ContextDriverDefinition, StorageAPIEndpointFn, StorageApiBuilderDefinition, UrlMappingDatabaseDefinition, UrlMappingServiceDefinition, APICoreDefinition} from 'studiocms/storage-api';