Replies: 2 comments 2 replies
-
Multiple classes inherit from On the other hand, I'm not a fan of APIs relying on strings, e.g. |
Beta Was this translation helpful? Give feedback.
-
@gildas-lormeau I see the "BlobWriter" , class Uint8ArrayWriter extends BlobWriter {
async getData(){
const blob = await super.getData();
console.log(blob);
return new Uint8Array(await blob.arrayBuffer());
}
}
class TextWriter extends BlobWriter{
constructor(encoding){
super(encoding);
}
async getData(){
const blob = await super.getData();
return await blob.text();
}
}
class Data64URIWriter extends Uint8ArrayWriter{
constructor(contentType){
super();
this.contentType = contentType;
}
async getData(){
return "data:" + (this.contentType || "") + ";base64,"+btoa(await super.getData());
}
} |
Beta Was this translation helpful? Give feedback.
-
不如增加一个流ReadableStream?
await entry.getData(new zip.Uint8ArrayWriter(),opt) => await entry.getData('json|Uint8Array',opt) ?
Uint8ArrayWriter|BlobWriter 简化~
Beta Was this translation helpful? Give feedback.
All reactions