import * as _path from "path" ; import { compact } from "./Array" ; import { ExifToolTask } from "./ExifToolTask" ; export class RewriteAllTagsTask extends ExifToolTask < void > { private constructor ( args ) { super ( args ) ; } static for ( imgSrc , imgDest , allowMakerNoteRepair ) { const args = compact ( [ "-all=" , "-tagsfromfile" , "@" , "-all:all" , "-unsafe" , "-icc_profile" , allowMakerNoteRepair ? "-F" : undefined , _path . resolve ( imgSrc ) , "-out" , _path . resolve ( imgDest ) , ] ) ; return new RewriteAllTagsTask ( args ) ; } parse ( data , error ? ) { if ( error != null ) { const str = String ( error ) ; if ( str . match ( /\berror\b/i ) != null && ! str . match ( /\bwarning\b/i ) ) { throw error ; } } if ( null == data . match ( /^\s*1 image files creat/i ) ) { throw ( error ?? new Error ( data . trim ( ) . split ( "\n" ) [ 0 ] ?? "Missing expected status message" ) ) ; } } }