@yagisumi/groonga-stdio-client
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@yagisumi/groonga-stdio-client

For testing purposes.
Groonga Standard I/O interface client.

NPM version install size DefinitelyTyped
Build Status Coverage percentage

Usage

import { createGroongaClient } from '@yagisumi/groonga-stdio-client'

async function main() {
  const client = createGroongaClient(dbPath, { groongaPath: 'groonga' })
  const r1 = await client.commandAsync('status').catch(() => undefined)

  client.command('table_list', (err, data) => {
    if (err) {
      console.error(err)
    } else {
      console.log(data)
    }
  })
}
main()

API

createGroongaClient

alias: createClient

function createGroongaClient(
  db_path: string, 
  options?: { groongaPath?: string; readInterval?: number }
): GroongaStdioClient

Creats a client. Same as new GroongaStdioClient(db_path, options)

GroongaStdioClient

command

command(
  command: string,
  options: object,
  callback: (err: Error, data: any) => void
): void
command(
  command: string,
  callback: (err: Error, data: any) => void
): void

Executes a command with a callback.

commandAsync

commandAsync(
  command: string,
  options: object
): Promise<any>
commandAsync(
  command: string
): Promise<any>

Executes a command and returns a promise.

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i @yagisumi/groonga-stdio-client

Weekly Downloads

25

Version

0.1.0

License

MIT

Unpacked Size

58.8 kB

Total Files

11

Last publish

Collaborators

  • yagisumi