MCPcopy Create free account
hub / github.com/decaporg/decap-cms / deleteFiles

Method deleteFiles

packages/decap-cms-backend-forgejo/src/API.ts:520–541  ·  view source on GitHub ↗
(paths: string[], message: string)

Source from the content-addressed store, hash-verified

518 }
519
520 async deleteFiles(paths: string[], message: string) {
521 if (this.useOpenAuthoring) {
522 throw new APIError(
523 'Cannot delete published entries as an Open Authoring user!',
524 403,
525 API_NAME,
526 );
527 }
528
529 const operations: ChangeFileOperation[] = await Promise.all(
530 paths.map(async path => {
531 const sha = await this.getFileSha(path);
532
533 return {
534 operation: FileOperation.DELETE,
535 path,
536 sha,
537 } as ChangeFileOperation;
538 }),
539 );
540 return this.changeFiles(operations, { commitMessage: message });
541 }
542
543 toBase64(str: string) {
544 return Promise.resolve(Base64.encode(str));

Callers 1

API.spec.jsFile · 0.45

Calls 3

getFileShaMethod · 0.95
changeFilesMethod · 0.95
mapMethod · 0.80

Tested by

no test coverage detected