我最终通过使用url加载器和
this solution
用于将base64转换为Blob。
// Load file at webpack compilation time
const zipFileRaw: string = require("url-loader!../test.zip");
const [match, contentType, base64] = zipFileRaw.match(/^data:(.+);base64,(.*)$/);
// Convert the base64 to a Blob
// Souce: https://stackoverflow.com/a/20151856/626911
const file = base64toBlob(base64, contentType);
// Construct a 'change' event with file Blob
const event: any = { type: "change", target: { files: [file] } };
// Fire the event
$("#file-chooser").trigger(event);