nodegin/tglib

Error: Unable to create client: ENOENT: no such file or directory, open 'my/dir/libtdjson.so

Closed this issue · 3 comments

`
const { Client } = require('tglib')
async function main() {
const client = new Client({
apiId: 'YOUR_API_ID',
apiHash: 'YOUR_API_HASH',
phoneNumber: 'YOUR_PHONE_NUMBER',
})

await client.connect()

const result = await client.fetch({
    '@type': 'getChats',
    'offset_order': '9223372036854775807',
    'offset_chat_id': 0,
    'limit': 100,
})

// latest 100 chats will be returned
console.log(result)

}

main()`

Please double check your binary path is correct.

├── index.js
├── node_modules
│   ├── ansi-escapes
│   ├── ansi-regex
│   ├── ansi-styles
│   ├── bindings
│   ├── chalk
│   ├── chardet
│   ├── cli-cursor
│   ├── cli-width
│   ├── color-convert
│   ├── color-name
│   ├── debug
│   ├── escape-string-regexp
│   ├── external-editor
│   ├── ffi-napi
│   ├── figures
│   ├── get-symbol-from-current-process-h
│   ├── get-uv-event-loop-napi-h
│   ├── has-flag
│   ├── iconv-lite
│   ├── inquirer
│   ├── is-fullwidth-code-point
│   ├── is-promise
│   ├── lodash
│   ├── mimic-fn
│   ├── ms
│   ├── mute-stream
│   ├── node-addon-api
│   ├── onetime
│   ├── os-tmpdir
│   ├── ref-napi
│   ├── ref-struct-di
│   ├── restore-cursor
│   ├── run-async
│   ├── rxjs
│   ├── safer-buffer
│   ├── signal-exit
│   ├── string-width
│   ├── strip-ansi
│   ├── supports-color
│   ├── symbol-observable
│   ├── tglib
│   ├── through
│   ├── tmp
│   └── uuid
├── package.json
└── package-lock.json

index.js

`
const { Client } = require('tglib')

async function main() {
    const client = new Client({
        apiId       : 'YOUR_API_ID',
        apiHash     : 'YOUR_API_HASH',
        phoneNumber : 'YOUR_PHONE_NUMBER',
    })

    await client.connect()

    const result = await client.fetch({
        '@type'          : 'getChats',
        'offset_order'   : '9223372036854775807',
        'offset_chat_id' : 0,
        'limit'          : 100,
    })

    // latest 100 chats will be returned
    console.log(result)
}

main()

`

You have to compile the binary yourself.

Getting started

Build the binary (https://github.com/tdlib/td#building)