Question

How I obtain the file bytes from bundle inputData?


I have a file as input and I can't get the bytes, when I zap for example with a file from Google Drive I get this as input:

hydrate eJx1jk9zgjAU×L_LOzMd_mmLMzOEoUwtINGxY-XC×BA1gYQKAYu0373B2mP3ULu_f

e8CpJKKSpWp_ovCBBAYWGSjsCQOYZIMHM_1bHP8AABpG1WJtqH1LbAsZzQau54BmJCa^RN_ rqNIwI7RMs8kFsNsTrtsx0qg14sTrvcNTC5wP3n3BVWHSi_Aoc9rrkg6edBvNIdQYFa- tJloVk nd2

7Yy14Dm6ZC8DghCSYGCD3u-XigpD614PePJGan3YG-nU30UilUdr81-4RsnORM75UU_R36Ebv

L3vdik8yXGi-P358YVVFBB75-CulumZvm07ZZY2hTPrI76_JcJE4T-y8PoaL4tdekZrtfrD1kpc6s:1 q14Ki:h48rk3iHmPQcT7ca4TORPbELNVM|||hydrate

And of course, when I get the bytes it is not what I expect since they are not the same bytes of the original fileI get the input via bundle.inputData.new_data, this is my code:

const publishData = (z, bundle) => {
    ...
     const data = bundle.inputData.new_data;
     ...
     function publish(record, publisher, host) {...}

  
}
module.exports = {
...
     operation: {
         inputFields: [
             {key: "methods", label: "Method", choices: {hosted: 'Hosted', ipfs: 'IPFS'}, required: true},
             {key: "new_data", label: "Data", required: false}
         ],
         perform: publishData,
         sample: sample
     },
};


Do I need to dehydrate it to work whit the bytes?


Thank you


0 replies

Be the first to reply!

Reply