diff --git a/dist/index.d.ts b/dist/index.d.ts index c4c2f4a..33956d3 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,5 +1,7 @@ +/// import ProtomuxRPC from "protomux-rpc"; export default class RPC extends ProtomuxRPC { constructor(stream: any, options?: {}); + request(method: any, value?: Buffer | Uint8Array | string, options?: {}): Promise; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 26ac068..f9a46a4 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,cAAc,CAAA;AAOtC,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW;gBAC5B,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK;CASxC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,WAAW,MAAM,cAAc,CAAC;AAOvC,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW;gBAC9B,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK;IAW/B,OAAO,CACX,MAAM,EAAE,GAAG,EACX,KAAK,GAAE,MAAM,GAAG,UAAU,GAAG,MAAqB,EAClD,OAAO,KAAK;CAQf"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index c7c6740..8b36fec 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9,9 +9,16 @@ export default class RPC extends ProtomuxRPC { options = { ...{ id: ID, - valueEncoding: c.json - }, ...options + valueEncoding: c.json, + }, + ...options, }; super(stream, options); } + async request(method, value = b4a.from(""), options = {}) { + if (!b4a.isBuffer(value)) { + value = b4a.from(value); + } + return super.request(method, value, options); + } }