fix(build): align TypeScript and test imports with NodeNext builds and safely copy Uint8Array inputs in browser processing
This commit is contained in:
@@ -146,7 +146,7 @@ export class WebPdfProcessor implements IWebPdfProcessor {
|
||||
}
|
||||
|
||||
if (input instanceof Uint8Array) {
|
||||
return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
||||
return this.uint8ArrayToArrayBuffer(input);
|
||||
}
|
||||
|
||||
if (input instanceof File || input instanceof Blob) {
|
||||
@@ -420,4 +420,10 @@ export class WebPdfProcessor implements IWebPdfProcessor {
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private uint8ArrayToArrayBuffer(input: Uint8Array): ArrayBuffer {
|
||||
const arrayBuffer = new ArrayBuffer(input.byteLength);
|
||||
new Uint8Array(arrayBuffer).set(input);
|
||||
return arrayBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user