txttosl-api

2.0.1 • Public • Published

txttosl-api-node

npm package

License: MIT

A simple Node module to allow using TxtToSL's API to translate text into sign languages.

const txttosl = require('txttosl-api');
 
txttosl.translate('Hello world!', 'BSL').then((url) => {
  console.log(url);
  // example output: https://v.txttosl.com/yirCaRNq.gif
});

More options are avaliable with the third argument:

const txttosl = require('txttosl-api');
 
txttosl.translate('Hello world!', 'BSL', {hoster: 'imgur'}).then((url) => {
  console.log(url);
  // example output: https://i.imgur.com/1kzUhOJ.gif
});
 
const txttosl = require('txttosl-api');
 
txttosl.translate('Hello world!', 'BSL', {overlay: false}).then((url) => {
  console.log(url);
  // example output: https://v.txttosl.com/BkakvkDo.gif
});

Progress callback / feedback is avaliable in the fourth and fifth arguments:

const txttosl = require('txttosl-api');
const progressCallback = (msg) => { console.log(`callback: ${msg}`); };
 
txttosl.translate('Hello world!', 'BSL', {}, progressCallback, 'my-project-identifier')
.then((url) => {
  console.log(`url: ${url}`);
});
 
/* example output:
  callback: Importing library 'yaspin'...
  ...etc...
  callback: Uploading...
  callback: Uploaded to: https://v.txttosl.com/fvzPhJim.gif
  url: https://v.txttosl.com/fvzPhJim.gif
*/

Package Sidebar

Install

npm i txttosl-api

Weekly Downloads

3

Version

2.0.1

License

MIT

Unpacked Size

5.45 kB

Total Files

5

Last publish

Collaborators

  • oojmed