1.0.0 • Published 4 years ago

@yagisumi/win-output-debug-string v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@yagisumi/win-output-debug-string

Windows OutputDebugString() and monitor.

NPM version DefinitelyTyped
Requirements Build Status

Installation

$ npm i @yagisumi/win-output-debug-string

Usage

import { OutputDebugString, monitor } from '@yagisumi/win-output-debug-string'

const r = monitor.start(({ pid, message }) => {
  console.log(`[${pid}] ${message}`)
})

if (r.error) {
  console.error(r.error)
  process.exit()
}

const iid = setInterval(() => {
  OutputDebugString('message')
}, 1000)

setTimeout(() => {
  clearInterval(iid)
  monitor.stop()
}, 10000)

API

OutputDebugString(message: string): void

Calls OutputDebugString().

monitor.start(cb: (info: { pid: number, message: string }) => void): OK | ERR

Starts monitoring OutputDebugString outputs. The character encoding of message is converted to system default Windows ANSI code page.

type OK = { ok: true, error: undefined }
type ERR = { ok: false, error: { name: string, message: string }}

monitor.stop(): boolean

Returns true if stop operation is performed, otherwise returns false.

License

MIT License