@@ -108,39 +108,39 @@ public static User getUser(Config config) {
108108 }
109109
110110 @ SuppressWarnings ("unused" )
111- public static CompletableFuture <ConversionResult > convert (Path fromFile , String toFormat , Param ... params ) throws IOException {
112- return convert (fromFile , toFormat , Config .defaults ().getSecret (), params );
111+ public static CompletableFuture <ConversionResult > convertFile (Path fromFile , String toFormat , Param ... params ) throws IOException {
112+ return convertFile (fromFile , toFormat , Config .defaults ().getSecret (), params );
113113 }
114114
115- public static CompletableFuture <ConversionResult > convert (Path fromFile , String toFormat , String secret , Param ... params ) throws IOException {
115+ public static CompletableFuture <ConversionResult > convertFile (Path fromFile , String toFormat , String secret , Param ... params ) throws IOException {
116116 Param [] fileParam = new Param []{new Param ("file" , fromFile )};
117117 return convert (getFileExtension (fromFile ), toFormat , Param .concat (fileParam , params ), Config .defaults (secret ));
118118 }
119119
120120 @ SuppressWarnings ("unused" )
121- public static void convert (String fromPathToFile , String toPathToFile ) {
122- convert (fromPathToFile , toPathToFile , Config .defaults ().getSecret ());
121+ public static void convertFile (String fromPathToFile , String toPathToFile ) {
122+ convertFile (fromPathToFile , toPathToFile , Config .defaults ().getSecret ());
123123 }
124124
125- public static void convert (String fromPathToFile , String toPathToFile , String secret , Param ... params ) {
125+ public static void convertFile (String fromPathToFile , String toPathToFile , String secret , Param ... params ) {
126126 try {
127127 Path fromPath = Paths .get (fromPathToFile );
128128 Path toPath = Paths .get (toPathToFile );
129- convert (fromPath , getFileExtension (toPath ), secret , params ).get ().saveFile (toPath ).get ();
129+ convertFile (fromPath , getFileExtension (toPath ), secret , params ).get ().saveFile (toPath ).get ();
130130 } catch (IOException | ExecutionException | InterruptedException e ) {
131131 throw new RuntimeException (e );
132132 }
133133 }
134134
135- public static List <Path > convertFile (String fromPathToFile , String toFormat , String outputDirectory , Param ... params ) {
136- return convertFile (fromPathToFile , toFormat , outputDirectory , Config .defaults ().getSecret (), params );
135+ public static List <Path > convertFileToDir (String fromPathToFile , String toFormat , String outputDirectory , Param ... params ) {
136+ return convertFileToDir (fromPathToFile , toFormat , outputDirectory , Config .defaults ().getSecret (), params );
137137 }
138138
139- public static List <Path > convertFile (String fromPathToFile , String toFormat , String outputDirectory , String secret , Param ... params ) {
139+ public static List <Path > convertFileToDir (String fromPathToFile , String toFormat , String outputDirectory , String secret , Param ... params ) {
140140 try {
141141 Path fromPath = Paths .get (fromPathToFile );
142142 Path toPath = Paths .get (outputDirectory );
143- return convert (fromPath , toFormat , secret ).get ().saveFilesSync (toPath );
143+ return convertFile (fromPath , toFormat , secret , params ).get ().saveFilesSync (toPath );
144144 } catch (IOException | ExecutionException | InterruptedException e ) {
145145 throw new RuntimeException (e );
146146 }
@@ -176,6 +176,21 @@ public static Path convertRemoteFile(String url, String toPathToFile, String sec
176176 }
177177 }
178178
179+ public static List <Path > convertRemoteFileToDir (String url , String toFormat , String outputDirectory , Param ... params ) {
180+ return convertRemoteFileToDir (url , toFormat , outputDirectory , Config .defaults ().getSecret (), params );
181+ }
182+
183+ public static List <Path > convertRemoteFileToDir (String url , String toFormat , String outputDirectory , String secret , Param ... params ) {
184+ RemoteUploadResponse response = Http .remoteUpload (url , Config .defaults (secret ));
185+ try {
186+ Path toPath = Paths .get (outputDirectory );
187+ Param [] fileParam = new Param []{new Param ("file" , response .FileId )};
188+ return convert (response .FileExt , toFormat , Param .concat (fileParam , params ), Config .defaults (secret )).get ().saveFilesSync (toPath );
189+ } catch (ExecutionException | InterruptedException e ) {
190+ throw new RuntimeException (e );
191+ }
192+ }
193+
179194 private static String getFileExtension (Path path ) {
180195 String name = path .getFileName ().toString ();
181196 return name .substring (name .lastIndexOf ("." ) + 1 );
0 commit comments