Socket
Socket
Sign inDemoInstall

baidu-fanyi-api

Package Overview
Dependencies
10
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    baidu-fanyi-api

百度翻译API


Version published
Weekly downloads
2
decreased by-80%
Maintainers
1
Install size
803 kB
Created
Weekly downloads
 

Readme

Source

百度翻译API

本项目仅供学习参考

Build NPM Version

使用方式

  1. 通过npm安装baidu-fanyi-api
    npm i baidu-fanyi-api
    
  2. 导入BaiduFanyiAPI
    import { BaiduFanyiAPI } from 'baidu-fanyi-api';
    
    const api = new BaiduFanyiAPI();
    
    async function main() {
      await api.init();
      const data = await api.translate('我的', 'zh', 'en');
      console.log(data);
    }
    
    main();
    

功能概述

所有操作必须在init之后执行

  1. 多语种翻译
    await api.translate('你好', 'zh', 'en');
    
  2. 语种检测
    await api.langdetect('你好');
    
  3. 输入建议
    await api.suggest('你好');
    
  4. OCR图像识别
    const image = createReadStream(join(__dirname, '../img.png'));
    const data = await api.getOCR(image, 'en', 'en');
    
  5. TTS语音合成
    const steam = createWriteStream(join(__dirname, '../tts.mp3'));
    const data = await api.getTTS('你好!,我是一个机器人。', 'zh');
    data.pipe(steam);
    

Keywords

FAQs

Last updated on 25 Aug 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc