{"id":20982408,"url":"https://github.com/juliaaplavin/squashfs.jl","last_synced_at":"2026-03-15T08:21:00.787Z","repository":{"id":238906074,"uuid":"759482574","full_name":"JuliaAPlavin/SquashFS.jl","owner":"JuliaAPlavin","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-22T19:36:17.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T06:45:51.737Z","etag":null,"topics":["file-formats","squashfs"],"latest_commit_sha":null,"homepage":"","language":"Julia","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/JuliaAPlavin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-18T18:00:17.000Z","updated_at":"2024-09-24T18:47:53.000Z","dependencies_parsed_at":"2024-05-08T20:12:13.901Z","dependency_job_id":null,"html_url":"https://github.com/JuliaAPlavin/SquashFS.jl","commit_stats":null,"previous_names":["juliaaplavin/squashfs.jl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSquashFS.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSquashFS.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSquashFS.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FSquashFS.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaAPlavin","download_url":"https://codeload.github.com/JuliaAPlavin/SquashFS.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243384948,"owners_count":20282464,"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":["file-formats","squashfs"],"created_at":"2024-11-19T05:45:30.229Z","updated_at":"2025-12-26T08:21:11.576Z","avatar_url":"https://github.com/JuliaAPlavin.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ca id='Overview'\u003e\u003c/a\u003e\n\n\u003ca id='Overview-1'\u003e\u003c/a\u003e\n\n# Overview\n\n\nRead content of [SquashFS](https://en.wikipedia.org/wiki/SquashFS) filesystem images. Supports navigating the directory structure and reading files in images compressed using `gzip` (uses `CodecZlib`) or `zstd` (uses `CodecZstd`). Extended attributes and other features are not implemented and not planned for foreseeable future.\n\n\nAttains good performance and may easily beat reading from the regular file system. On a laptop with SSD and a SquashFS image containing 10'000 small files: 12-50k IOPS depending on the reading pattern; 250 Mb/s for reading large files. Both IOPS and bandwidth are limited by the decompression speed. Caching may help in certain scenarios of reading small files, but this is neither implemented nor planned. See the `benchmark` directory for details.\n\n\n\u003ca id='Example'\u003e\u003c/a\u003e\n\n\u003ca id='Example-1'\u003e\u003c/a\u003e\n\n# Example\n\n\nGenerate files that go into a SquashFS image, and create the sample image:\n\n\n```julia-repl\njulia\u003e orig_dir = pwd();\n\njulia\u003e tmp = mktempdir();\n\njulia\u003e cd(tmp);\n\njulia\u003e mkpath(\"./dir/subdir\");\n\njulia\u003e write(\"./dir/filea.txt\", \"aaa\");\n\njulia\u003e write(\"./dir/subdir/fileb.dat\", \"abc\");\n\njulia\u003e write(\"./dir/subdir/filec.dat\", \"def\");\n\njulia\u003e import squashfs_tools_jll: mksquashfs\n\njulia\u003e run(pipeline(`$mksquashfs dir image.sqsh`, stdout=devnull));\n\njulia\u003e cd(orig_dir);\n```\n\n\nOpen the SquashFS image and access it with common `Base` filesystem functions:\n\n\n```julia-repl\njulia\u003e import SquashFS\n\njulia\u003e img = SquashFS.open(joinpath(tmp, \"image.sqsh\"));\n\njulia\u003e root = SquashFS.rootdir(img);\n\njulia\u003e readdir(root)\n2-element Vector{String}:\n \"filea.txt\"\n \"subdir\"\n\njulia\u003e isdir(root)\ntrue\n\njulia\u003e isdir(joinpath(root, \"subdir\"))\ntrue\n\njulia\u003e [basename(f) for f in readdir(root; join=true) if isfile(f)]\n1-element Vector{String}:\n \"filea.txt\"\n\njulia\u003e read(joinpath(root, \"filea.txt\"), String)\n\"aaa\"\n\njulia\u003e readdir(joinpath(root, \"subdir\"))\n2-element Vector{String}:\n \"fileb.dat\"\n \"filec.dat\"\n\njulia\u003e read.(readdir(joinpath(root, \"subdir\"); join=true), String)\n2-element Vector{String}:\n \"abc\"\n \"def\"\n```\n\n\nSeveral specialized functions are provided as well, see reference docs below.\n\n\n\u003ca id='Reference'\u003e\u003c/a\u003e\n\n\u003ca id='Reference-1'\u003e\u003c/a\u003e\n\n# Reference\n\n\u003ca id='SquashFS.files_recursive-Tuple{SquashFS.Image, AbstractString}' href='#SquashFS.files_recursive-Tuple{SquashFS.Image, AbstractString}'\u003e#\u003c/a\u003e\n**`SquashFS.files_recursive`** \u0026mdash; *Method*.\n\n\n\n```julia\nfiles_recursive(img::SquashFS.Image, path::AbstractString) -\u003e Vector{String}\n\n```\n\nReturn the paths of all files contained in the directory `path` within SquashFS image `img`, recursively. Returned paths are relative to the specified `path`.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L70' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='SquashFS.open-Tuple{AbstractString}' href='#SquashFS.open-Tuple{AbstractString}'\u003e#\u003c/a\u003e\n**`SquashFS.open`** \u0026mdash; *Method*.\n\n\n\n```julia\nopen(fname::AbstractString; threaded) -\u003e SquashFS.Image\n\n```\n\nOpen SquashFS image file. Immediately reads list of all inodes, directory structure, and fragments table. These are always kept in memory for implementation simplicity and performance.\n\n`threaded` must be set to `true` to use the same image from multiple threads.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L40' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='SquashFS.openfile-Tuple{SquashFS.Image, Any}' href='#SquashFS.openfile-Tuple{SquashFS.Image, Any}'\u003e#\u003c/a\u003e\n**`SquashFS.openfile`** \u0026mdash; *Method*.\n\n\n\n```julia\nopenfile(img::SquashFS.Image, spec) -\u003e IOBuffer\n\n```\n\nOpen the file at `path` in the SquashFS image `img` and return as an `IO` object. For now just reads the whole content of the file and wraps it into an `IOBuffer`. May become more efficient in the future.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L104' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='SquashFS.readdir-Tuple{SquashFS.Image, AbstractString}' href='#SquashFS.readdir-Tuple{SquashFS.Image, AbstractString}'\u003e#\u003c/a\u003e\n**`SquashFS.readdir`** \u0026mdash; *Method*.\n\n\n\n```julia\nreaddir(img::SquashFS.Image, path::AbstractString; join) -\u003e Vector{String}\n\n```\n\nReturn the names in the directory `path` within SquashFS image `img`. When `join` is `false`, returns just the names in the directory as is; when `join` is `true`, returns `joinpath(path, name)` for each `name` so that the returned strings are full paths\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L59' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='SquashFS.readfile-Tuple{SquashFS.Image, AbstractString}' href='#SquashFS.readfile-Tuple{SquashFS.Image, AbstractString}'\u003e#\u003c/a\u003e\n**`SquashFS.readfile`** \u0026mdash; *Method*.\n\n\n\n```julia\nreadfile(img::SquashFS.Image, path::AbstractString) -\u003e Vector{UInt8}\n\n```\n\nRead content of the file at `path` in the SquashFS image `img`. Return a bytearray.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L95' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='SquashFS.readfile-Tuple{SquashFS.Image, Any, Type{String}}' href='#SquashFS.readfile-Tuple{SquashFS.Image, Any, Type{String}}'\u003e#\u003c/a\u003e\n**`SquashFS.readfile`** \u0026mdash; *Method*.\n\n\n\n```julia\nreadfile(img::SquashFS.Image, spec, _::Type{String}) -\u003e String\n\n```\n\nRead content of the file `spec` in the SquashFS image `img`. Returns a `String`. `spec` can be a path or another supported value such as an inode number.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L100' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='SquashFS.rglob' href='#SquashFS.rglob'\u003e#\u003c/a\u003e\n**`SquashFS.rglob`** \u0026mdash; *Function*.\n\n\n\n```julia\nrglob(img::SquashFS.Image, pattern) -\u003e Vector{String}\nrglob(img::SquashFS.Image, pattern, path::AbstractString) -\u003e Vector{String}\n\n```\n\nReturns the paths of all files matching `pattern` in directory `path` within SquashFS image `img`, recursively. `pattern` can be any object that supports `occursin(pattern, name::String)`: e.g. `String`, `Regex`, or patterns from the `Glob.jl` package.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/SquashFS.jl/blob/5497e837b4016b9985b152beade56976a86e34a7/src/api.jl#L74' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaaplavin%2Fsquashfs.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaaplavin%2Fsquashfs.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaaplavin%2Fsquashfs.jl/lists"}