tdl-tdlib-addon

Node.js N-API addon that provides bindings to TDLib

Usage no npm install needed!

<script type="module">
  import tdlTdlibAddon from 'https://cdn.skypack.dev/tdl-tdlib-addon';
</script>

README

tdl-tdlib-addon

npm

Node.js N-API addon that provides bindings to TDLib's libtdjson.

It is meant to be used with the tdl package.

tdl-tdlib-addon provides TypeScript and Flow typings out of the box.

Installation

$ npm install tdl-tdlib-addon

API

const { TDLib } = require('tdl-tdlib-addon')
constructor: new TDLib(libraryFile?: string, addonPath?: string)

libraryFile is the filename that will be passed to dlopen (LoadLibraryW on Windows).

By default libraryFile is tdjson.dll on Windows, libtdjson.dylib on macOS, and libtdjson.so on a different OS.

Examples:

new TDLib()
new TDLib('libtdjson.so')
new TDLib('libtdjson.dylib')
new TDLib('libtdjson.so', '../build/Release/td.node')

For other API see TDLib_API.md in the tdl repository root.