{"id":13817078,"url":"https://github.com/01alchemist/AS-LZMA","last_synced_at":"2025-05-15T19:31:04.247Z","repository":{"id":57093267,"uuid":"171914184","full_name":"01alchemist/AS-LZMA","owner":"01alchemist","description":"LZMA Decoder written in AssemblyScript","archived":false,"fork":false,"pushed_at":"2019-09-24T17:42:00.000Z","size":10957,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-18T23:56:40.286Z","etag":null,"topics":["assemblyscript","data-compression","lzma","typescript","webassembly"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/01alchemist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-21T17:21:15.000Z","updated_at":"2024-07-30T19:56:49.000Z","dependencies_parsed_at":"2022-08-22T21:40:06.975Z","dependency_job_id":null,"html_url":"https://github.com/01alchemist/AS-LZMA","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FAS-LZMA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FAS-LZMA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FAS-LZMA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FAS-LZMA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/01alchemist","download_url":"https://codeload.github.com/01alchemist/AS-LZMA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254407252,"owners_count":22066199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assemblyscript","data-compression","lzma","typescript","webassembly"],"created_at":"2024-08-04T06:00:33.189Z","updated_at":"2025-05-15T19:30:59.345Z","avatar_url":"https://github.com/01alchemist.png","language":"TypeScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"LZMA Decoder (AssemblyScript)\n============\n\nThis is an experimental lzma decoder written in [AssemblyScript](https://github.com/AssemblyScript/assemblyscript)\n\nExample\n-------\n\n[example code](/examples)\n\n```javascript\nvar memory = new WebAssembly.Memory({ initial: 160 })\n...\n// You know how to instantiate WASM module\nvar lzma = module.instance.exports\n\n// Get compressed data by fetch or by some other means\nvar inputData = new Uint8Array(await (await fetch('PATH/TO/COMPRESSED_FILE.lzma')).arrayBuffer())\n\n// Allocate memory to copy input data. \nconst inputDataPtr = lzma.newU8Array(inputData.length)\n\n// AssemblyScript ArrayBuffer header length\nconst AS_ARRAY_OFFSET = 24\n\n// Create an Uint8Array using allocated buffer and set input data\nconst u8Array = new Uint8Array(\n  memory.buffer,\n  inputDataPtr + AS_ARRAY_OFFSET,\n  inputData.length\n)\nu8Array.set(inputData)\n\nclass DecodeResult {\n  constructor(ptr, memory) {\n    const result = new Uint32Array(memory.buffer, ptr, 4)\n    const [success, error, unpackSize, dataPtr] = result;\n    this.success = success\n    this.error = error\n    if (this.success) {\n      this.unpackSize = unpackSize\n      this.data = new Uint8Array(\n        memory.buffer,\n        dataPtr + AS_ARRAY_OFFSET,\n        unpackSize\n      )\n    }\n  }\n}\n\n// Decode LZMA data\nconst resultPtr = lzma.decode(inputDataPtr)\nconst result = new DecodeResult(resultPtr, memory)\n\n// Decompressed data\nconsole.log(result.data)\n\n// If the data is plain text, decode using TextDecoder\n// const decoder = new TextDecoder()\n// const text = decoder.decode(result.data)\n// console.log(text)\n\n```\n\nHow to make lzma file\n----------------------\n\nDownload [lzma sdk] and use following command\n\n```sh\nlzma e input_filename.extension output_filename.lzma\n```\n\nDeveloped by [Nidin Vinayakan]\n\nLicense\n----\n\nMIT\n\n[lzma sdk]:http://www.7-zip.org/sdk.html\n[Nidin Vinayakan]:https://github.com/nidin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F01alchemist%2FAS-LZMA","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F01alchemist%2FAS-LZMA","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F01alchemist%2FAS-LZMA/lists"}