{"id":22221949,"url":"https://github.com/fabiospampinato/siar","last_synced_at":"2025-07-27T16:31:52.117Z","repository":{"id":190591120,"uuid":"682828241","full_name":"fabiospampinato/siar","owner":"fabiospampinato","description":"A simple random-access archive format.","archived":false,"fork":false,"pushed_at":"2023-09-24T16:28:50.000Z","size":37,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-20T15:11:37.467Z","etag":null,"topics":["access","archive","isomorphic","random","simple"],"latest_commit_sha":null,"homepage":"","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/fabiospampinato.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}},"created_at":"2023-08-25T01:23:47.000Z","updated_at":"2023-12-11T16:10:01.000Z","dependencies_parsed_at":"2023-08-25T11:44:56.916Z","dependency_job_id":null,"html_url":"https://github.com/fabiospampinato/siar","commit_stats":null,"previous_names":["fabiospampinato/siar"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fsiar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fsiar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fsiar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fsiar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/siar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817017,"owners_count":17824200,"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":["access","archive","isomorphic","random","simple"],"created_at":"2024-12-02T23:16:19.661Z","updated_at":"2024-12-02T23:16:20.422Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Siar\n\nA simple random-access archive format.\n\nA `siar` archive is a single binary file, containing a sha256 hash of the rest of the archive, followed by the length of the header, followed by the UTF8-encoded JSON header, followed by the concatenated contents of all the files.\n\nPaths inside the archive are always stored using `/` as the separator, with no prefix (e.g. `/` or `./`), and are case sensitive.\n\n## Features\n\n- The `siar` archive format is super simple.\n- A file can be extracted from a `siar` archive efficiently, with random access.\n- A `siar` archive can be pretty compact, for lots of small files it's significantly smaller than a tarball.\n- A `siar` archive can be created and read in the browser too.\n\n## Install\n\n```sh\nnpm install --save siar\n```\n\n## Usage\n\nYou would use the CLI commands like this:\n\n```sh\n# Pack a folder into an archive\nsiar pack my-folder my-archive.siar\n\n# Unpack an archive into a folder\nsiar unpack my-archive.siar my-folder\n\n# List the content of an archive\nsiar ls my-archive.siar\n\n# Extract a single file from an archive\nsiar extract my-archive.siar path/to/file.txt path/to/output_file.txt\n\n# View a single file from an archive, without extracting it\nsiar view my-archive.siar path/to/file.txt\n```\n\nYou would use the programmatic API like this:\n\n```ts\nimport {extract, get, ls, make, pack, read, unpack, view, visit} from 'siar';\n\n// Pack a folder into an archive -- just like with the \"pack\" command\n\nawait pack ( 'my-folder', 'my-archive.siar' );\n\n// Unpack an archive into a folder -- just like with the \"unpack\" command\n\nunpack ( 'my-archive.siar', 'my-folder' );\n\n// List the content of an archive -- just like with the \"ls\" command\n\nls ( 'my-archive.siar' );\n\n// Extract a single file from an archive -- just like with the \"extract\" command\n\nextract ( 'my-archive.siar', 'path/to/file.txt', 'path/to/output_file.txt' );\n\n// View a single file from an archive, without extracting it -- just like with the \"view\" command\n\nview ( 'my-archive.siar', 'path/to/file.txt' );\n\n// Read a single file from an archive -- like \"extract\" but it just gives you the file\n\nconst file = read ( 'my-archive.siar', 'path/to/file.txt' );\n\n// Make an archive from a map of files -- this function works in the browser too\n\nconst archive = await make ({\n  'path/to/file.txt': {\n    content: new Uint8Array (),\n    mode: 0o644, // Optional\n    mtime: 123456789 // Optional\n  },\n  'path/to/another-file.txt': {\n    content: new Uint8Array ()\n  }\n});\n\n// Get a single file from an archive -- this function works in the browser too\n\nconst file = get ( archive, 'path/to/file.txt' );\n\n// Visit files or folders in an archive -- this function works in the browser too\n\nvisit ( archive, file =\u003e { // Files only\n  file.name; // =\u003e 'file.txt'\n  file.path; // =\u003e 'path/to/file.txt'\n  file.content; // =\u003e Uint8Array ()\n  file.mode; // =\u003e 0o644\n  file.mtime; // =\u003e 123456789\n});\n\nvisit ( archive, folder =\u003e { // Folders only\n  folder.name; // =\u003e 'folder'\n  folder.path; // =\u003e 'path/to/folder'\n}, 'folder' );\n\nvisit ( archive, entry =\u003e { // Files and folders\n  if ( 'content' in entry ) {\n    console.log ( 'It is a file', entry );\n  } else {\n    console.log ( 'It is a folder', entry );\n  }\n}, '*' );\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fsiar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fsiar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fsiar/lists"}