@collight/dns-sd
    Preparing search index...

    Function decodeTXT

    • Decodes an input buffer or array of buffers (or strings) containing "key=value" pairs into a single object mapping keys to values.

      Each input item is expected to be a string or Buffer representing one key-value pair. Items that do not match the "key=value" pattern are ignored.

      Parameters

      • buffer: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[]

        A string, Buffer, or an array of these, each containing "key=value" format data.

      • binary: false

      Returns Record<string, string>

      An object where each key is mapped to its corresponding decoded value.

      decodeTXT([Buffer.from("foo=bar"), "baz=qux"])
      // { foo: "bar", baz: "qux" }

      decodeTXT(Buffer.from("hello=world"))
      // { hello: "world" }

      decodeTXT(["invalid", "key=value"])
      // { key: "value" } // "invalid" ignored
    • Decodes an input buffer or array of buffers (or strings) containing "key=value" pairs into a single object mapping keys to values.

      Each input item is expected to be a string or Buffer representing one key-value pair. Items that do not match the "key=value" pattern are ignored.

      Parameters

      • buffer: string | Buffer<ArrayBufferLike> | (string | Buffer<ArrayBufferLike>)[]

        A string, Buffer, or an array of these, each containing "key=value" format data.

      • binary: true

      Returns Record<string, Buffer>

      An object where each key is mapped to its corresponding decoded value.

      decodeTXT([Buffer.from("foo=bar"), "baz=qux"])
      // { foo: "bar", baz: "qux" }

      decodeTXT(Buffer.from("hello=world"))
      // { hello: "world" }

      decodeTXT(["invalid", "key=value"])
      // { key: "value" } // "invalid" ignored