theweipeng commented on code in PR #1825:
URL: https://github.com/apache/fury/pull/1825#discussion_r1756228145
##########
javascript/packages/fury/lib/gen/object.ts:
##########
@@ -81,10 +83,17 @@ class ObjectSerializerGenerator extends
BaseSerializerGenerator {
const options = this.description.options;
const expectHash = computeStructHash(this.description);
const metaInformation =
Buffer.from(computeMetaInformation(this.description));
+ const fields = Object.entries(options.props).map(([key, value]) => {
+ return new FieldInfo(key, value.type);
+ });
+ const binary = TypeMeta.from_fields(256, fields).to_bytes();
+ const binaryLength = binary.length; // Capture the length of the binary
data
+ // Encode binary data as a base64 string
+ const binaryBase64 = Buffer.from(binary).toString("base64");
return `
${this.builder.writer.int32(expectHash)};
-
${this.builder.writer.buffer(`Buffer.from("${metaInformation.toString("base64")}",
"base64")`)};
+ ${this.builder.writer.buffer(binaryBase64)};
Review Comment:
if the base64 string is "AQAAAAAAAAACgATsEgsABQg="
the code you generated will be `bw.buffer(AQAAAAAAAAACgATsEgsABQg=);` it
is includes syntax error
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]