{"id":16244559,"url":"https://github.com/indexzero/baltar","last_synced_at":"2025-08-16T08:23:40.725Z","repository":{"id":66035794,"uuid":"46088020","full_name":"indexzero/baltar","owner":"indexzero","description":"A few small utilities for working with tarballs and http.","archived":false,"fork":false,"pushed_at":"2025-04-04T12:52:45.000Z","size":37,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-05T12:11:29.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/indexzero.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":"2015-11-12T23:46:05.000Z","updated_at":"2024-07-03T09:11:17.000Z","dependencies_parsed_at":"2023-02-21T20:16:18.696Z","dependency_job_id":null,"html_url":"https://github.com/indexzero/baltar","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":"0.11111111111111116","last_synced_commit":"415bafac6c41154d35dbb7a2ee3057ef16ac8daf"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/indexzero/baltar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fbaltar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fbaltar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fbaltar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fbaltar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indexzero","download_url":"https://codeload.github.com/indexzero/baltar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fbaltar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270684990,"owners_count":24627921,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-10T14:19:35.858Z","updated_at":"2025-08-16T08:23:40.713Z","avatar_url":"https://github.com/indexzero.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# baltar\nA few small utilities for working with tarballs and http. Because you need tarballs over HTTP like:\n\n![](https://i.giphy.com/media/52HjuHsfVO69q/giphy-downsized.gif)\n\n## Usage\n\n### Fetch \u0026 send tarballs over the network\n\n##### `baltar.pull(opts, callback)`\n\nMakes a request to `opts.url` and unpacks it to `opts.path`. `baltar.pull` is the only method which accepts a callback so that it pass back all of the entries from the `tar.Extract` stream. The end of pipechain is also returned for future stream operations (if desired).\n\n- `opts.url`: {string} Location of the receiver.\n- `opts.headers`: {Object} HTTP headers to send.\n- `opts.method`: {string} HTTP Method to send.\n- `opts.path`: {string} Directory or file to unpack to.\n- `opts.tarball`: {string} **Optional** Path to save tarball to.\n- `returns`: {tar.Extract} Extraction stream for the pulled tarball.\n\n``` js\nbaltar.pull({\n  url: 'https://example.com/path/to/any/file.tgz',\n  path: 'location/to/untar/into',\n}, function (err, entries) {\n  //\n  // Unpacked tarball now exists in\n  // 'location/to/untar/into'. All\n  // tar entries are returned to work with\n  //\n  var filenames = entries.map(function (entry) {\n    return e.path;\n  });\n\n  console.log(filenames);\n});\n```\n\n##### `baltar.push(opts)`\n\nPushes a tarball created from `opts.path` to `opts.url`\noptionally accepting a `opts.method` and returns a stream\nthat represents the response.\n\n- `opts.path`: Directory or file to pack\n- `opts.ignoreFiles`: Extra ignore files to parse\n- `opts.url`: {string} Location of the receiver.\n- `opts.headers`: {Object} HTTP headers to send.\n- `opts.method`: {string} HTTP Method to send.\n- `returns`: {hyperquest} HTTP request stream to `opts.url`.\n\n``` js\nbaltar.push({\n  path: 'directory/or/file/to/pack',\n  url: 'http://example.com/path/to/tarball/uploaded.tgz'\n})\n.on('error', function (err) {\n  // Handle any HTTP errors (e.g. Internet is down, etc.)\n  console.dir(err);\n})\n.on('finish', function () {\n  console.log('HTTP request finished.')\n});\n```\n\nThe stream returned is an instance of [`hyperquest`](https://github.com/substack/hyperquest), so you can perform any additional stream operations on it.\n\n### Pack and unpack tarballs locally\n\n##### `baltar.unpack(opts)`\n\nReturns a stream which will unpack and stream into the specified `opts.path`.\n\n- `opts`: {Object|string} Options for unpacking tarball.\n- `opts.path`: Directory or file to unpack to\n- `returns`: {Stream} Gunzip and untar pipechain to `opts.path`.\n\n``` js\nfs.createReadStream('path/to/any/file.tgz')\n  .pipe(baltar.unpack({ path: 'location/to/untar/into' }))\n  .on('error', function (err) {\n    // Handle any HTTP errors (e.g. bad tarball, etc.)\n    console.dir(err);\n  })\n  .on('entry', function (e) { entries.push(e.path); })\n  .on('done', function () {\n    //\n    // Unpacked tarball now exists in\n    // 'location/to/untar/into'.\n    //\n  });\n```\n\n##### `baltar.pack(opts)`\n\nReturns a stream representing the tar.gz packed version of `opts.dir`.\n\n- `opts`: {Object|string} Options for packing tarball.\n- `opts.path`: Directory or file to pack.\n- `opts.ignoreFiles`: Extra ignore files to parse.\n\n``` js\nbaltar.pack('just/a/path/also/works')\n  .pipe(hyperquest.post('http://example.com/tarball/uploaded.tgz'))\n```\n\n##### LICENSE: MIT\n##### AUTHOR: [Charlie Robbins](http://github.com/indexzero)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Fbaltar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findexzero%2Fbaltar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Fbaltar/lists"}