Add decodeAny
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { google } from "./generated/codecimpl";
|
||||
|
||||
/**
|
||||
* Decodes a serialized [google.protobuf.Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto)
|
||||
* and returns the components.
|
||||
*/
|
||||
export function decodeAny(serialized: Uint8Array): { readonly typeUrl: string; readonly value: Uint8Array } {
|
||||
const envelope = google.protobuf.Any.decode(serialized);
|
||||
return {
|
||||
typeUrl: envelope.type_url,
|
||||
value: envelope.value,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { decodeAny } from "./any";
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Decodes a serialized [google.protobuf.Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto)
|
||||
* and returns the components.
|
||||
*/
|
||||
export declare function decodeAny(
|
||||
serialized: Uint8Array,
|
||||
): {
|
||||
readonly typeUrl: string;
|
||||
readonly value: Uint8Array;
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { decodeAny } from "./any";
|
||||
Reference in New Issue
Block a user