Skip to content

createFiles

createFiles(optionsOrClient, destroyRef?): Files

Defined in: libs/ccs-files-user-client/src/angular/files.ts:53

Builds an Angular-idiomatic wrapper over FilesClient: the client plus a Signal of the uploads.

A plain factory, not an @Injectable() class: the package ships plain compiled JS (no Angular compiler pass), so a decorated class here would have no DI metadata. Call it from your own service:

@Injectable({ providedIn: 'root' })
export class FilesService {
private readonly files = createFiles(
{ apiUrl, tenantId, applicationId, getAccessToken: this.tokens.getAccessToken },
inject(DestroyRef),
);
readonly uploads = this.files.uploads;
readonly client = this.files.client;
}

Pass a ready FilesClient (from FilesClient.fromTokenRoute) instead of options when it is built elsewhere. With a DestroyRef the client is disposed when that injection context is destroyed (uploads in flight pause, their tickets stay resumable); otherwise call client.dispose() yourself.

FilesClientOptions | FilesClient

DestroyRef

Files