-
-
Notifications
You must be signed in to change notification settings - Fork 62
Description
`const KdbxReader = () => {
const [db, setDb] = useState(null);
const [error, setError] = useState("");
console.log(kdbxweb); // Should show the library object
console.log(kdbxweb.ProtectedValue);
function readFileAsUint8Array(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(new Uint8Array(reader.result));
reader.onerror = reject;
reader.readAsArrayBuffer(file);
});
}
// Usage:
const handleFileChange = async (event) => {
// When user selects a .kdbx file
const file = event.target.files[0];
const buffer = await readFileAsUint8Array(file);
const creds = new kdbxweb.Credentials(
kdbxweb.ProtectedValue.fromString("My password")
);
const db = await kdbxweb.Kdbx.load(buffer, creds);
};
`
I am facing this error continously
"uncaught (in promise) KdbxError: Error InvalidArg: data
at handleFileChange (App.tsx?t=1743508462124:41:36)"
I even tried const buffer = new Uint8Array(await file.arrayBuffer()); but not working
help