@@ -15,7 +15,7 @@ DeepL's best-in-class translation technology.
1515The DeepL Node.js library offers a convenient way for applications written for
1616Node.js to interact with the DeepL API. We intend to support all API functions
1717with the library, though support for new features may be added to the library
18- after they’ re added to the API.
18+ after they' re added to the API.
1919
2020## Getting an authentication key
2121
@@ -264,6 +264,64 @@ directly:
264264- ` filename ` : if the input file is not provided as file path, this option is
265265 needed to specify the file extension.
266266- ` extraRequestParameters ` : same as in [ Text translation options] ( #text-translation-options ) .
267+ - ` enableDocumentMinification ` : A ` bool ` value. If set to ` true ` , the library will try to minify a document
268+ before translating it through the API, sending a smaller document if the file contains a lot of media. This is
269+ currently only supported for ` pptx ` and ` docx ` files. See also [ Document minification] ( #document-minification ) .
270+
271+ #### Document minification
272+ In some contexts, one can end up with large document files (e.g. PowerPoint presentations
273+ or Word files with many contributors, especially in a larger organization). However, the
274+ DeepL API enforces a limit of 30 MB for most of these files (see Usage Limits in the docs).
275+ In the case that most of this size comes from media included in the documents (e.g. images,
276+ videos, animations), document minification can help.
277+ In this case, the library will create a temporary directory to extract the document into,
278+ replace the large media with tiny placeholders, create a minified document, translate that
279+ via the API, and re-insert the original media into the original file. Please note that this
280+ requires a bit of additional (temporary) disk space, we recommend at least 2x the file size
281+ of the document to be translated.
282+
283+ To use document minification, simply pass the option to the ` translateDocument() ` function:
284+ ``` typescript
285+ await translator .translateDocument (
286+ inFile , outFile , " en" , " de" , { enableDocumentMinification: true }
287+ );
288+ ```
289+ In order to use document minification with the lower-level ` uploadDocument() ` ,
290+ ` isDocumentTranslationComplete() ` and ` downloadDocument() ` methods as well as other details,
291+ see the ` DocumentMinifier ` class.
292+
293+
294+ Currently supported document types for minification:
295+ 1 . ` pptx `
296+ 2 . ` docx `
297+
298+ Currently supported media types for minification:
299+ 1 . ` png `
300+ 2 . ` jpg `
301+ 3 . ` jpeg `
302+ 4 . ` emf `
303+ 5 . ` bmp `
304+ 6 . ` tiff `
305+ 7 . ` wdp `
306+ 8 . ` svg `
307+ 9 . ` gif `
308+ 10 . ` mp4 `
309+ 11 . ` asf `
310+ 12 . ` avi `
311+ 13 . ` m4v `
312+ 14 . ` mpg `
313+ 15 . ` mpeg `
314+ 16 . ` wmv `
315+ 17 . ` mov `
316+ 18 . ` aiff `
317+ 19 . ` au `
318+ 20 . ` mid `
319+ 21 . ` midi `
320+ 22 . ` mp3 `
321+ 23 . ` m4a `
322+ 24 . ` wav `
323+ 25 . ` wma `
324+
267325
268326### Glossaries
269327
0 commit comments