I want to read a file with the “docx” library.
I have already generated the docx document, but what I want to do is fetch the document again to validate it since I have added a “fingerprint” to it to validate if they have edited the originally generated document, kind of like what banks do.
I have seen examples like the following.
const buffer = fs.readFileSync('./uploads/ta.docx');
const doc = new Document(buffer);
But this is throwing me the following error:
TypeError: e.sections is not iterable
I have also tried the following code:
const buffer = fs.readFileSync('./uploads/ta.docx');
const doc = new Document();
doc.load(buffer);
And it gives me the same error again: TypeError: e.sections is not iterable
Is there another way to do the document validation or am I going astray?
I appreciate your time and thanks in advance.