datasync-asset-store
द्वारा contentstack
Public API and DataSync integration for the filesystem asset store — use for start, FSAssetStore, config, and asset paths.
npx skills add https://github.com/contentstack/datasync-asset-store-filesystem --skill datasync-asset-storeDataSync asset store API – DataSync Asset Store Filesystem
When to use
- Implementing or changing how assets are downloaded, stored, or removed on disk
- Wiring this package into DataSync Manager (
setAssetStore) - Debugging URL parsing,
baseDir, or path patterns
Instructions
- Entry: Consumers typically
require('@contentstack/datasync-asset-store-filesystem')and pass the module to DataSync Manager; the packagemainis./dist(compiled fromsrc/index.ts). - Lifecycle: Call
start(config)to get aPromisethat resolves to anFSAssetStoreinstance.setConfig/getConfighold merged config;assetStoreInstanceis exported for the active instance afterstart. - Class:
FSAssetStore(src/filesystem.ts) implements download/unpublish flows usingundicifor HTTP,fsfor writes, and helpers fromsrc/index.tsfor paths. - Path helpers:
getAssetLocationandgetFileLocationbuild directory/file paths from asset URLs andassetStoreconfig (pattern,patternWithBranch, optionalassetFolderPrefixKey). Contentstack asset hostnames are matched via regex insrc/index.ts. - Defaults:
defaultConfiginsrc/config.ts— e.g.assetStore.baseDir: './_contents',patternandpatternWithBranchfor folder layout. Merge with app config as in the README example. - Cross-module config: README documents
content-store-filesystem.baseDiralongside this module; keep docs aligned when changing default paths. - Errors: User-facing strings and errors are centralized in
src/messages.tswhere applicable.