feat: add SQS + EventBridge

This commit is contained in:
Zakaria
2026-09-24 22:34:04 -04:00
parent 9bbe80b5f2
commit 1b129e9dcf
37 changed files with 2902 additions and 66 deletions
@@ -109,6 +109,28 @@ export function createZipArchive(entries: ZipEntry[]): Uint8Array {
return concat([...localParts, ...centralParts, endRecord])
}
/** Reads one uncompressed file from the simple ZIP packages created by this console. */
export function readStoredZipEntry(archive: Uint8Array, name: string): string | null {
const decoder = new TextDecoder()
let offset = 0
while (offset + 30 <= archive.length && new DataView(archive.buffer, archive.byteOffset + offset).getUint32(0, true) === 0x04034b50) {
const view = new DataView(archive.buffer, archive.byteOffset + offset)
const compression = view.getUint16(8, true)
const size = view.getUint32(22, true)
const nameLength = view.getUint16(26, true)
const extraLength = view.getUint16(28, true)
const fileName = decoder.decode(archive.slice(offset + 30, offset + 30 + nameLength))
const dataOffset = offset + 30 + nameLength + extraLength
if (dataOffset + size > archive.length) return null
if (fileName === name) {
if (compression !== 0) return null
return decoder.decode(archive.slice(dataOffset, dataOffset + size))
}
offset = dataOffset + size
}
return null
}
function concat(parts: Uint8Array[]): Uint8Array {
const total = parts.reduce((sum, part) => sum + part.length, 0)
const out = new Uint8Array(total)