import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'fileExtension' } ) export class FileExtensionPipe implements PipeTransform { transform ( path ) { if ( ! path ) { return null ; } const file = path . split ( '/' ) . pop ( ) ; const extension = file . split ( '.' ) . pop ( ) ; return extension ; } }