55} from "./table" ;
66import exiftool , { ExiftoolProcess } from "node-exiftool" ;
77import { exiftoolBinPath } from "../common/binaries" ;
8- import { withArgsTempFile } from "../common/args_file" ;
98
109export async function addFiles ( { filePaths } : { filePaths : string [ ] } ) {
1110 for ( const filePath of filePaths ) {
@@ -136,13 +135,9 @@ async function removeExif({
136135 . open ( )
137136 // .then((pid) => console.log('Started exiftool process %s', pid))
138137 . then ( ( ) => {
139- const args = [ "- charset filename=UTF8" , "overwrite_original" ] ;
138+ const args = [ "charset filename=UTF8" , "overwrite_original" ] ;
140139
141- return withArgsTempFile ( args , argsTempFilePath => {
142- return ep . writeMetadata ( filePath , { all : "" } , [
143- `-@ ${ argsTempFilePath } `
144- ] ) ;
145- } ) ;
140+ return ep . writeMetadata ( filePath , { all : "" } , args ) ;
146141 } )
147142 . catch ( console . error ) ;
148143
@@ -162,31 +157,21 @@ async function getExif({
162157 . open ( )
163158 // .then((pid) => console.log('Started exiftool process %s', pid))
164159 . then ( ( ) => {
165- const args = [
166- "-charset filename=UTF8" ,
167- "-File:all" ,
168- "-ExifToolVersion" ,
169- "-x FileSize" ,
170- "-x SourceFile"
171- ] ;
172-
173- return withArgsTempFile ( args , argsTempFilePath => {
174- return exiftoolProcess
175- . readMetadata ( filePath , [ `-@ ${ argsTempFilePath } ` ] )
176- . then (
177- exifData => {
178- if ( exifData . data === null ) {
179- return { } ;
180- }
181-
182- const hash = exifData . data [ 0 ] ;
183- return cleanExifData ( hash ) ;
184- } ,
185- err => {
186- console . error ( err ) ;
187- }
188- ) ;
189- } ) ;
160+ const args = [ "charset filename=UTF8" , "-File:all" , "-ExifToolVersion" ] ;
161+
162+ return exiftoolProcess . readMetadata ( filePath , args ) . then (
163+ exifData => {
164+ if ( exifData . data === null ) {
165+ return { } ;
166+ }
167+
168+ const hash = exifData . data [ 0 ] ;
169+ return cleanExifData ( hash ) ;
170+ } ,
171+ err => {
172+ console . error ( err ) ;
173+ }
174+ ) ;
190175 } )
191176 . catch ( console . error ) ;
192177
0 commit comments