Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurred when I serialize a PB and turned it to base64 and decode it and then parse. #45

Open
XadillaX opened this issue Aug 7, 2014 · 1 comment

Comments

@XadillaX
Copy link

XadillaX commented Aug 7, 2014

var str = encodeBase64(schema.serialize(pb));
var obj = schema.parse(new Buffer(decodeBase64(str));

And the error is:

undefined:1
function(self) {  var f = this;  return function(arg) {    return f.call(self,
                                                                    ^
Error: Malformed message
    at Function.parse (<anonymous>:1:70)
    at Function.module.exports.createFromPB (/Users/XadillaX/code/node/getui/lib/transparent.js:93:36)
    at Function.module.exports.createFromBase64 (/Users/XadillaX/code/node/getui/lib/transparent.js:106:17)
    at Object.<anonymous> (/Users/XadillaX/code/node/getui/test/template.js:15:25)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
@denofiend
Copy link

use Buffer in bas64 decode and encode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants