Skip to content

Error: Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ? #3316

@b521f771d8991e6f1d8e65ae05a8d783

Description

Seems similar as this one, but that one was closed: #2539

Minimal example: https://stackblitz.com/edit/node-cuffquaa?file=index.js,test.docx.base64.json,package.json

import { patchDocument } from 'docx';
import { base64StringToBlob } from "blob-util";

import dataBase64 from './test.docx.base64.json' with { type: "json" };

// if you download data, everything works great
const data = base64StringToBlob(dataBase64);

const docx = await patchDocument({
  data,
  outputType: "base64"
});

console.log(docx);

The example is pretty basic, I get the following error:

Image

Am I doing anything wrong?


Edit:
it works if I convert data like this
const data = new Uint8Array(await base64StringToBlob(FSGTemplate, DOCX_MIME_TYPE).arrayBuffer());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions