{"_id":"@ankur.shipthis/puppeteer-google-translate","_rev":"1-afc8a7d866a86e1670c1a870ea38a0a8","name":"@ankur.shipthis/puppeteer-google-translate","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.4":{"name":"@ankur.shipthis/puppeteer-google-translate","version":"1.0.4","description":"Translate texts or documents with Google Translate using Puppeteer","types":"lib/index.d.ts","main":"lib/index.js","author":{"name":"Ankur Dutta"},"license":"MIT","keywords":["puppeteer","google","translate"],"homepage":"https://github.com/bloodred17/puppeteer-google-translate","bugs":{"url":"https://github.com/bloodred17/puppeteer-google-translate/issues"},"repository":{"type":"git","url":"git+https://github.com/bloodred17/puppeteer-google-translate.git"},"scripts":{"test":"jest","format":"prettier --w .","build":"tsc"},"dependencies":{"puppeteer":"^8.0.0"},"devDependencies":{"@types/jest":"^26.0.20","@types/puppeteer":"^5.4.3","prettier":"^2.2.1","ts-jest":"^26.5.2","typescript":"^4.2.2"},"gitHead":"d07d73d50e50941a6a25b95fe9a9d83475eaa54e","_id":"@ankur.shipthis/puppeteer-google-translate@1.0.4","_nodeVersion":"14.15.0","_npmVersion":"7.20.3","dist":{"integrity":"sha512-WftaKh7fUZ8MuxFI4rJGUS+/EKf7nLtb4nlrll1ZD2VeJjgJRhw9RLrrl7A3kxDquOXNos4b0rovIMy+EiXa0Q==","shasum":"b36bcc989864dfd2e0013d36b29cb682d4d76509","tarball":"https://registry.npmjs.org/@ankur.shipthis/puppeteer-google-translate/-/puppeteer-google-translate-1.0.4.tgz","fileCount":23,"unpackedSize":18570,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhDj0PCRA9TVsSAnZWagAAIywP/0OsisV6FI/Xc2rF76N/\ngJj3DDr2D4GllSqBgy6LGhxMUVdiVzdOEOkksCqF3g5D4Ugm4e3vGRoFOgYq\nRz4CFWGQZz+uBY6b0g+A8XH7FPYu8pubhtzccgnTEDprJYFHtTrsT1ZFvn0B\nPqoLauGx+UisnmLFlLnrtC53eeML+VXrWXKzcTTxtYS8AbyguGk0hL+aBSAs\nM41xA5KtC9+z+PpiWheR+t28rqk3jHgT+mV1s9+ef+Yi6tWTM8nHGVm4TZP3\nWkgPkbaPQ0DHqvEv7bXHp/4WhKCPSY69D/eRKkSHi4krgyetFV3ODESfzEZb\nYVxtM/cescU2Kubo/tQGMDC7880Ze0QESUQkqSw5no4YDLhpromuezRpRPUh\nj3SH1qMlrJaKiBTA/LOEv9a+jODPPbhUNv2mtS/RszTQTBwd897Qzy8+somq\n7vB62yg8RyGXuSoLVuIqhs0tXgV6MX5D1qF+4O+/CEUZoyrF5yf2A0aIWn7v\noXKqgXb45fMan/dpGoQCY0VyvA01o8Z8HHzpMJs7V2UDTi8d1INna0qTHoph\n2H1oxo2CfysZF1RihciEe1cASFwrGfzOcmdKTOZvWjrD3IPbEY30OESLjHxu\ne4P9Ro1HDrhsk9y4fjntzFXqNiU13CsHxd5HLX+/sj6o6r0QCdoVs6Toa+X2\nkKeO\r\n=TeLy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAvcIxqFVLtArrt0Yp+bXjl0wbqnjJ7PWUnDcAVW7M2RAiEA40YqE7R3iKBLbq6U0TFWeEr+REri969cbZb6mf2dWt4="}]},"_npmUser":{"name":"ankur.shipthis","email":"ankur@shipthis.co"},"directories":{},"maintainers":[{"name":"ankur.shipthis","email":"ankur@shipthis.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-google-translate_1.0.4_1628323087266_0.7408690831210991"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-07T07:58:07.205Z","1.0.4":"2021-08-07T07:58:07.412Z","modified":"2022-04-04T14:13:45.324Z"},"maintainers":[{"name":"ankur.shipthis","email":"ankur@shipthis.co"}],"description":"Translate texts or documents with Google Translate using Puppeteer","homepage":"https://github.com/bloodred17/puppeteer-google-translate","keywords":["puppeteer","google","translate"],"repository":{"type":"git","url":"git+https://github.com/bloodred17/puppeteer-google-translate.git"},"author":{"name":"Ankur Dutta"},"bugs":{"url":"https://github.com/bloodred17/puppeteer-google-translate/issues"},"license":"MIT","readme":"# Fork of: puppeteer-google-translate\n\nTranslate texts or documents with Google Translate using Puppeteer\n\nThis is a fork of [puppeteer-google-translate](https://github.com/alanleungcn/puppeteer-google-translate)\n\n\n<!-- ## Installation -->\n<!-- \n```bash\nnpm i puppeteer-google-translate\n``` -->\n\n## Changes\n\nAt the time of fork the version of [puppeteer-google-translate](https://github.com/alanleungcn/puppeteer-google-translate) is 1.0.3.\n\n- This version supports direct supply of launch options to Puppeteer.\n- It separates Options into TranslationOptions and PptrLaunchOptions and exposes them for better typescript support.\n\n## Usage\n\n### Javascript\n\n```js\nconst { translateText, translateDocs } = require('puppeteer-google-translate');\n\nconst launchOptions = { timeout: 10000, headless: true };\n// Puppeteer launch options\n\nconst translationOptions = { from: 'en', to: 'es' };\n// translate from English to Spanish\n\ntranslateText('text', translationOptions, launchOptions).then((result) => {\n  // result: texto\n});\n\ntranslateText(['text', 'array'], translationOptions, launchOptions).then((result) => {\n  // result: ['texto', 'formación']\n});\n\ntranslateDocs('txt.txt', translationOptions, launchOptions).then((result) => {\n  // result: translated text\n});\n\ntranslateDocs(['txt.txt', 'docx.docx'], translationOptions, launchOptions).then((result) => {\n  // result: array of translated text\n});\n```\n\n### Typescript\n\n```ts\nimport { translateText, translateDocs } from 'puppeteer-google-translate';\n\n(async () => {\n  const launchOptions: PptrLaunchOptions = { timeout: 10000, headless: true };\n  // Puppeteer launch options\n\n  const translationOptions: TranslationOptions = { from: 'en', to: 'es' };\n  // translate from English to Spanish\n\n  const result = await translateText('text', translationOptions, launchOptions);\n  // result: texto\n})()\n```\n\n## API\n\n### translateText(text, TranslationOptions, PptrLaunchOptions)\n\n- `text` \\<string | string[]> Text or an array of text to be translated\n- returns: Promise\\<string | string[]>\n\n### translateDocs(path, TranslationOptions, PptrLaunchOptions)\n\n- `path` \\<string | string[]> Path or an array of path that points to documents\n- returns: Promise\\<string | string[]>\n  \n- `TranslationOptions` \\<Object>\n  - `to` \\<string> Language to translate to\n  - `from` \\<?string> Language to translate from. Defaults to `auto`\n  \n- `PptrLaunchOptions` \\<?Object> Puppeteer Launch Options\n  - `timeout` \\<?number> Time in ms before Puppeteer throws an error, pass `0` to disable timeout. Defaults to `10000`\n  - `headless` \\<?boolean> Whether to run browser in headless mode. Defaults to `true`\n  - `args` \\<?Array[string]> Puppeteer launch arguements\n\n\n## Disclaimer\n\nThis is a fork of [puppeteer-google-translate](https://github.com/alanleungcn/puppeteer-google-translate)\n\nIt is only for educational purposes, for Google translation api please check out [the official document](https://cloud.google.com/translate)\n","readmeFilename":"README.md"}