MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / toZipSource

Function toZipSource

src/pkg/utils/jszip-x.ts:180–193  ·  view source on GitHub ↗
(
  content: InputByType[keyof InputByType]
)

Source from the content-addressed store, hash-verified

178}
179
180async function toZipSource(
181 content: InputByType[keyof InputByType]
182): Promise<Blob | Uint8Array<ArrayBuffer> | ArrayBuffer> {
183 if (typeof content === "string") {
184 return new TextEncoder().encode(content) as Uint8Array<ArrayBuffer>;
185 }
186 if (content instanceof Uint8Array || content instanceof ArrayBuffer) {
187 return content;
188 }
189 if (typeof Blob !== "undefined" && content instanceof Blob) {
190 return content;
191 }
192 return new TextEncoder().encode(String(content)) as Uint8Array<ArrayBuffer>;
193}
194
195async function toUint8Array(content: ZipEntryData): Promise<Uint8Array<ArrayBuffer>> {
196 if (typeof content === "string") {

Callers 1

loadAsyncMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected