MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / duplicateAsset

Function duplicateAsset

apps/desktop/src/main/vault.ts:3315–3323  ·  view source on GitHub ↗
(root: string, rel: string)

Source from the content-addressed store, hash-verified

3313}
3314
3315export async function duplicateAsset(root: string, rel: string): Promise<AssetMeta> {
3316 const source = await assertAssetFile(root, rel)
3317 const ext = path.extname(source.abs)
3318 const base = path.basename(source.abs, ext)
3319 const finalName = await uniqueFilename(path.dirname(source.abs), `${base} copy${ext}`)
3320 const destAbs = path.join(path.dirname(source.abs), finalName)
3321 await fs.copyFile(source.abs, destAbs)
3322 return await assetMetaForPath(root, destAbs)
3323}
3324
3325export async function deleteAsset(root: string, rel: string): Promise<DeletedAsset> {
3326 const source = await assertAssetFile(root, rel)

Callers 2

vault.test.tsFile · 0.90
registerIpcFunction · 0.90

Calls 3

assertAssetFileFunction · 0.85
uniqueFilenameFunction · 0.85
assetMetaForPathFunction · 0.85

Tested by

no test coverage detected