Closed expiron closed 7 years ago
You cannot convert node.js Buffer to ArrayBuffer this way: when you call .buffer
, it can return more bytes than included in node Buffer (which is a slice of the originally allocated ArrayBuffer), and this is what happens in your case as well. To convert between them, you should use an array, for example. So, if you replace
let dataAsArrayBuffer = fs.readFileSync('./empty.kdbx').buffer;
with
let dataAsArrayBuffer = new Uint8Array(fs.readFileSync('./empty.kdbx')).buffer;
it will work. https://nodejs.org/api/buffer.html
Thanks!
Hello. Today I created an empty kdbx file using code:
And then I opened it using code:
But it threw the error:
Using KeePass Password Manager or KeeWeb Online, it (kdbx file I created) can be opened normally. Also, I have tried to create a kdbx file using KeePass whose structure like this:
And I opened it using the code as mentioned but got the same error. I want to know what's the meaning of 'BadSignature' and how to solve my problem. My environment is Node.js v8.5.0 and Windows 10.