My question is:
how to successfully use the method getResourceByHash(...)
of Evernote API?
What I have done:
I have got the hex hash of em-media in the note content: 80ad525cd14de8f925487c02afc9ab21
Then I use the following function to turn the hexadecimal String
to bytes:
function hex2bin(hex){
var bytes = [];
for(var i=0; i< hex.length-1; i+=2) {
bytes.push(parseInt(hex.substr(i, 2), 16));
}
return String.fromCharCode.apply(String, bytes);
}
var bin = hex2bin("80ad525cd14de8f925487c02afc9ab21");
At next I apply the variable to the function getResourceByHash(...)
in this way:
noteStore.getResourceByHash(GUID, bin, true, true, true,
function(err,result){
console.log(err);
console.log(result);
}
);
But the output turns out:
{identifier: 'Resources', key: 'c280c2ad525cc3914dc3a8c3b925487c02c2afc389c2ab21'}
undefined
In all, I am confused.