{"id":16244593,"url":"https://github.com/indexzero/tar-buffer","last_synced_at":"2025-03-19T18:33:21.230Z","repository":{"id":35103705,"uuid":"39280339","full_name":"indexzero/tar-buffer","owner":"indexzero","description":"Buffers entries from a tar.Parse() stream into memory","archived":false,"fork":false,"pushed_at":"2015-07-21T23:30:01.000Z","size":180,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T21:05:14.323Z","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}},"created_at":"2015-07-18T00:00:41.000Z","updated_at":"2024-07-03T09:11:47.000Z","dependencies_parsed_at":"2022-08-18T01:55:36.462Z","dependency_job_id":null,"html_url":"https://github.com/indexzero/tar-buffer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Ftar-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Ftar-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Ftar-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Ftar-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indexzero","download_url":"https://codeload.github.com/indexzero/tar-buffer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221729949,"owners_count":16871147,"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":[],"created_at":"2024-10-10T14:19:51.059Z","updated_at":"2024-10-27T20:32:49.233Z","avatar_url":"https://github.com/indexzero.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tar-buffer\n\nBuffers entries from a tar.Parse() stream into memory.\n\n## Usage\n\n``` js\nvar fs = require('fs');\nvar zlib = require('zlib');\nvar tar = require('tar');\nvar TarBuffer = require('tar-buffer');\n\nvar parser = tar.Parse();\nvar buffer = new TarBuffer(parser)\n  .on('error', function (err) { console.log ('tar error: %s', err); })\n  .on('end', function () {\n    //\n    // Log all our files in memory\n    //\n    console.dir(buffer.files);\n  });\n\n//\n// Read our tarball and pipe it to the tar parser.\n//\nfs.createReadStream('any-tarball.tgz')\n  .pipe(zlib.Unzip())\n  .on('error', function (err) { console.log('zlib error: %s', err); })\n  .pipe(parser);\n```\n\n### API\n\n#### Options\n\n- `log`: (optional) Log function to use. Expects `console.log` API.\n- `ignore`: (optional) Array (or `/\\r?\\n/` delimted string) of ignorefile lines.\n- `strip`: (optional) Number of preceding segments of an entry path to strip.\n- `maxSize`: (optional) Maximum number of bytes in a single file to buffer.\n\n#### Events\n- `entry`: similar the `entry` events emitted by the `tar.Parse()` stream except that these entries have been fully read into memory. The contents are located on `e.content`:\n``` js\nvar buffer = new TarBuffer(parser)\n  .on('entry', function (e) {\n    console.log(e.content); // Log all file contents\n  });\n```\n\n#### Why isn't this a proper stream?\n\nUnderneath the covers, `tar` emits several events, not just `data` events which have to be handled seprately from a traditional stream.\n\n##### Author: [Charlie Robbins](https://github.com/indexzero)\n##### LICENSE: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Ftar-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findexzero%2Ftar-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Ftar-buffer/lists"}