Skip to content

yagisumi/node-groonga-stdio-client

Repository files navigation

@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

About

Groonga Standard I/O interface client.

Resources

License

Stars

Watchers

Forks

Packages

No packages published