0.1.1 • Published 11 months ago

deeplx.js v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

deeplx.js

A Node.js port of DeepLX.

Installation

npm install deeplx.js
# pnpm 
pnpm add deeplx.js

Usage

import { translate, TooManyRequestsError } from 'deeplx.js'

const run = () => {
  translate({
    content: '你好, 世界',
    proxy: 'http://127.0.0.1:7890',
    souceLang: 'ZH'
  })
    .then(console.log)
    .catch(e => {
      if (e instanceof TooManyRequestsError) {
        console.log('error catched', e.message)
      }
    })
}

run()

Options

import type { ProxyAgent } from 'undici'

export interface DeepLXOptions {
  content: string
  targetLang?: string
  sourceLang?: string
  needAlternative?: boolean
  proxy?: ProxyAgent.Options
}

Example

see example.mjs

License

MIT © nemurubaka

0.1.1

11 months ago

0.1.0

12 months ago

0.0.1

12 months ago