A Node.js port of DeepLX.
npm install deeplx.js
# pnpm
pnpm add deeplx.js
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()
import type { ProxyAgent } from 'undici'
export interface DeepLXOptions {
content: string
targetLang?: string
sourceLang?: string
needAlternative?: boolean
proxy?: ProxyAgent.Options
}
see example.mjs
MIT © nemurubaka