{"action":"closed","number":96,"pull_request":{"url":"https://api.github.com/repos/cthackers/adm-zip/pulls/96","id":17632694,"html_url":"https://github.com/cthackers/adm-zip/pull/96","diff_url":"https://github.com/cthackers/adm-zip/pull/96.diff","patch_url":"https://github.com/cthackers/adm-zip/pull/96.patch","issue_url":"https://api.github.com/repos/cthackers/adm-zip/issues/96","number":96,"state":"closed","locked":false,"title":"add an optional filter to addLocalFolder","user":{"login":"greggman","id":234804,"avatar_url":"https://avatars.githubusercontent.com/u/234804?v=3","gravatar_id":"","url":"https://api.github.com/users/greggman","html_url":"https://github.com/greggman","followers_url":"https://api.github.com/users/greggman/followers","following_url":"https://api.github.com/users/greggman/following{/other_user}","gists_url":"https://api.github.com/users/greggman/gists{/gist_id}","starred_url":"https://api.github.com/users/greggman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggman/subscriptions","organizations_url":"https://api.github.com/users/greggman/orgs","repos_url":"https://api.github.com/users/greggman/repos","events_url":"https://api.github.com/users/greggman/events{/privacy}","received_events_url":"https://api.github.com/users/greggman/received_events","type":"User","site_admin":false},"body":"The filter can be a RegExp or a Function. If `RegExp.test(path)` or\r\n`filter(path)` returns true the file is included.\r\n\r\nIt seemed better to include the filter in addLocalFolder\r\nthan roll my own loop since addLocalFilter deals with windows\r\nbackslash for example and any other cross platform weirdness\r\ncould be added there.\r\n\r\nI tested it by hand with this test. I wasn't sure if I was supposed\r\nto add that test somewhere or not.\r\n\r\n    var Zip = require(\"../adm-zip\");\r\n\r\n    var printEntries = function(label, zip) {\r\n      console.log(\"----: \" + label);\r\n      zip.getEntries().forEach(function(entry, ii) {\r\n        console.log(\"\" + ii + \": \" + entry.entryName);\r\n      });\r\n    };\r\n\r\n    var zip = new Zip();\r\n    zip.addLocalFolder(__dirname);\r\n    printEntries(\"zip1\", zip);\r\n\r\n    var zip = new Zip();\r\n    zip.addLocalFolder(__dirname, \"\", /\\.txt$/);\r\n    printEntries(\"zip2\", zip);\r\n\r\n    var zip = new Zip();\r\n    zip.addLocalFolder(__dirname, \"\", function(f) { return f.substring(f.length - 4) == \".zip\"; });\r\n    printEntries(\"zip3\", zip);\r\n\r\nWhich printed\r\n\r\n    ----: zip1\r\n    0: addlocalfolder-test.js\r\n    1: assets/attributes_test/New folder/hidden.txt\r\n    2: assets/attributes_test/New folder/hidden_readonly.txt\r\n    3: assets/attributes_test/New folder/readonly.txt\r\n    4: assets/attributes_test/New folder/somefile.txt\r\n    5: assets/attributes_test/New folder/\r\n    6: assets/attributes_test/asd/New Text Document.txt\r\n    7: assets/attributes_test/asd/\r\n    8: assets/attributes_test/blank file.txt\r\n    9: assets/attributes_test/\r\n    10: assets/attributes_test.zip\r\n    11: assets/fast.zip\r\n    12: assets/fastest.zip\r\n    13: assets/linux_arc.zip\r\n    14: assets/maximum.zip\r\n    15: assets/normal.zip\r\n    16: assets/store.zip\r\n    17: assets/ultra.zip\r\n    18: assets/\r\n    19: index.js\r\n    ----: zip2\r\n    0: assets/attributes_test/New folder/hidden.txt\r\n    1: assets/attributes_test/New folder/hidden_readonly.txt\r\n    2: assets/attributes_test/New folder/readonly.txt\r\n    3: assets/attributes_test/New folder/somefile.txt\r\n    4: assets/attributes_test/asd/New Text Document.txt\r\n    5: assets/attributes_test/blank file.txt\r\n    ----: zip3\r\n    0: assets/attributes_test.zip\r\n    1: assets/fast.zip\r\n    2: assets/fastest.zip\r\n    3: assets/linux_arc.zip\r\n    4: assets/maximum.zip\r\n    5: assets/normal.zip\r\n    6: assets/store.zip","created_at":"2014-06-26T07:02:51Z","updated_at":"2015-02-09T07:58:22Z","closed_at":"2015-02-09T07:58:22Z","merged_at":"2015-02-09T07:58:22Z","merge_commit_sha":"b26f9c459d2936fb771691f2dc7b06a7e84f651a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cthackers/adm-zip/pulls/96/commits","review_comments_url":"https://api.github.com/repos/cthackers/adm-zip/pulls/96/comments","review_comment_url":"https://api.github.com/repos/cthackers/adm-zip/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cthackers/adm-zip/issues/96/comments","statuses_url":"https://api.github.com/repos/cthackers/adm-zip/statuses/4041cc3b1ecaee66cd835f6d4daa2ed0a9a34ff4","head":{"label":"greggman:add-filter","ref":"add-filter","sha":"4041cc3b1ecaee66cd835f6d4daa2ed0a9a34ff4","user":{"login":"greggman","id":234804,"avatar_url":"https://avatars.githubusercontent.com/u/234804?v=3","gravatar_id":"","url":"https://api.github.com/users/greggman","html_url":"https://github.com/greggman","followers_url":"https://api.github.com/users/greggman/followers","following_url":"https://api.github.com/users/greggman/following{/other_user}","gists_url":"https://api.github.com/users/greggman/gists{/gist_id}","starred_url":"https://api.github.com/users/greggman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggman/subscriptions","organizations_url":"https://api.github.com/users/greggman/orgs","repos_url":"https://api.github.com/users/greggman/repos","events_url":"https://api.github.com/users/greggman/events{/privacy}","received_events_url":"https://api.github.com/users/greggman/received_events","type":"User","site_admin":false},"repo":{"id":21230801,"name":"adm-zip","full_name":"greggman/adm-zip","owner":{"login":"greggman","id":234804,"avatar_url":"https://avatars.githubusercontent.com/u/234804?v=3","gravatar_id":"","url":"https://api.github.com/users/greggman","html_url":"https://github.com/greggman","followers_url":"https://api.github.com/users/greggman/followers","following_url":"https://api.github.com/users/greggman/following{/other_user}","gists_url":"https://api.github.com/users/greggman/gists{/gist_id}","starred_url":"https://api.github.com/users/greggman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggman/subscriptions","organizations_url":"https://api.github.com/users/greggman/orgs","repos_url":"https://api.github.com/users/greggman/repos","events_url":"https://api.github.com/users/greggman/events{/privacy}","received_events_url":"https://api.github.com/users/greggman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/greggman/adm-zip","description":"A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk","fork":true,"url":"https://api.github.com/repos/greggman/adm-zip","forks_url":"https://api.github.com/repos/greggman/adm-zip/forks","keys_url":"https://api.github.com/repos/greggman/adm-zip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greggman/adm-zip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greggman/adm-zip/teams","hooks_url":"https://api.github.com/repos/greggman/adm-zip/hooks","issue_events_url":"https://api.github.com/repos/greggman/adm-zip/issues/events{/number}","events_url":"https://api.github.com/repos/greggman/adm-zip/events","assignees_url":"https://api.github.com/repos/greggman/adm-zip/assignees{/user}","branches_url":"https://api.github.com/repos/greggman/adm-zip/branches{/branch}","tags_url":"https://api.github.com/repos/greggman/adm-zip/tags","blobs_url":"https://api.github.com/repos/greggman/adm-zip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greggman/adm-zip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greggman/adm-zip/git/refs{/sha}","trees_url":"https://api.github.com/repos/greggman/adm-zip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greggman/adm-zip/statuses/{sha}","languages_url":"https://api.github.com/repos/greggman/adm-zip/languages","stargazers_url":"https://api.github.com/repos/greggman/adm-zip/stargazers","contributors_url":"https://api.github.com/repos/greggman/adm-zip/contributors","subscribers_url":"https://api.github.com/repos/greggman/adm-zip/subscribers","subscription_url":"https://api.github.com/repos/greggman/adm-zip/subscription","commits_url":"https://api.github.com/repos/greggman/adm-zip/commits{/sha}","git_commits_url":"https://api.github.com/repos/greggman/adm-zip/git/commits{/sha}","comments_url":"https://api.github.com/repos/greggman/adm-zip/comments{/number}","issue_comment_url":"https://api.github.com/repos/greggman/adm-zip/issues/comments/{number}","contents_url":"https://api.github.com/repos/greggman/adm-zip/contents/{+path}","compare_url":"https://api.github.com/repos/greggman/adm-zip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greggman/adm-zip/merges","archive_url":"https://api.github.com/repos/greggman/adm-zip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greggman/adm-zip/downloads","issues_url":"https://api.github.com/repos/greggman/adm-zip/issues{/number}","pulls_url":"https://api.github.com/repos/greggman/adm-zip/pulls{/number}","milestones_url":"https://api.github.com/repos/greggman/adm-zip/milestones{/number}","notifications_url":"https://api.github.com/repos/greggman/adm-zip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greggman/adm-zip/labels{/name}","releases_url":"https://api.github.com/repos/greggman/adm-zip/releases{/id}","created_at":"2014-06-26T06:41:15Z","updated_at":"2014-06-20T06:50:51Z","pushed_at":"2014-06-26T07:00:59Z","git_url":"git://github.com/greggman/adm-zip.git","ssh_url":"git@github.com:greggman/adm-zip.git","clone_url":"https://github.com/greggman/adm-zip.git","svn_url":"https://github.com/greggman/adm-zip","homepage":"","size":710,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cthackers:master","ref":"master","sha":"7b0c0a3c4e3fbdff3146c01274d64a0a23e4e575","user":{"login":"cthackers","id":210514,"avatar_url":"https://avatars.githubusercontent.com/u/210514?v=3","gravatar_id":"","url":"https://api.github.com/users/cthackers","html_url":"https://github.com/cthackers","followers_url":"https://api.github.com/users/cthackers/followers","following_url":"https://api.github.com/users/cthackers/following{/other_user}","gists_url":"https://api.github.com/users/cthackers/gists{/gist_id}","starred_url":"https://api.github.com/users/cthackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cthackers/subscriptions","organizations_url":"https://api.github.com/users/cthackers/orgs","repos_url":"https://api.github.com/users/cthackers/repos","events_url":"https://api.github.com/users/cthackers/events{/privacy}","received_events_url":"https://api.github.com/users/cthackers/received_events","type":"User","site_admin":false},"repo":{"id":3515094,"name":"adm-zip","full_name":"cthackers/adm-zip","owner":{"login":"cthackers","id":210514,"avatar_url":"https://avatars.githubusercontent.com/u/210514?v=3","gravatar_id":"","url":"https://api.github.com/users/cthackers","html_url":"https://github.com/cthackers","followers_url":"https://api.github.com/users/cthackers/followers","following_url":"https://api.github.com/users/cthackers/following{/other_user}","gists_url":"https://api.github.com/users/cthackers/gists{/gist_id}","starred_url":"https://api.github.com/users/cthackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cthackers/subscriptions","organizations_url":"https://api.github.com/users/cthackers/orgs","repos_url":"https://api.github.com/users/cthackers/repos","events_url":"https://api.github.com/users/cthackers/events{/privacy}","received_events_url":"https://api.github.com/users/cthackers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cthackers/adm-zip","description":"A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk","fork":false,"url":"https://api.github.com/repos/cthackers/adm-zip","forks_url":"https://api.github.com/repos/cthackers/adm-zip/forks","keys_url":"https://api.github.com/repos/cthackers/adm-zip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cthackers/adm-zip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cthackers/adm-zip/teams","hooks_url":"https://api.github.com/repos/cthackers/adm-zip/hooks","issue_events_url":"https://api.github.com/repos/cthackers/adm-zip/issues/events{/number}","events_url":"https://api.github.com/repos/cthackers/adm-zip/events","assignees_url":"https://api.github.com/repos/cthackers/adm-zip/assignees{/user}","branches_url":"https://api.github.com/repos/cthackers/adm-zip/branches{/branch}","tags_url":"https://api.github.com/repos/cthackers/adm-zip/tags","blobs_url":"https://api.github.com/repos/cthackers/adm-zip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cthackers/adm-zip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cthackers/adm-zip/git/refs{/sha}","trees_url":"https://api.github.com/repos/cthackers/adm-zip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cthackers/adm-zip/statuses/{sha}","languages_url":"https://api.github.com/repos/cthackers/adm-zip/languages","stargazers_url":"https://api.github.com/repos/cthackers/adm-zip/stargazers","contributors_url":"https://api.github.com/repos/cthackers/adm-zip/contributors","subscribers_url":"https://api.github.com/repos/cthackers/adm-zip/subscribers","subscription_url":"https://api.github.com/repos/cthackers/adm-zip/subscription","commits_url":"https://api.github.com/repos/cthackers/adm-zip/commits{/sha}","git_commits_url":"https://api.github.com/repos/cthackers/adm-zip/git/commits{/sha}","comments_url":"https://api.github.com/repos/cthackers/adm-zip/comments{/number}","issue_comment_url":"https://api.github.com/repos/cthackers/adm-zip/issues/comments/{number}","contents_url":"https://api.github.com/repos/cthackers/adm-zip/contents/{+path}","compare_url":"https://api.github.com/repos/cthackers/adm-zip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cthackers/adm-zip/merges","archive_url":"https://api.github.com/repos/cthackers/adm-zip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cthackers/adm-zip/downloads","issues_url":"https://api.github.com/repos/cthackers/adm-zip/issues{/number}","pulls_url":"https://api.github.com/repos/cthackers/adm-zip/pulls{/number}","milestones_url":"https://api.github.com/repos/cthackers/adm-zip/milestones{/number}","notifications_url":"https://api.github.com/repos/cthackers/adm-zip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cthackers/adm-zip/labels{/name}","releases_url":"https://api.github.com/repos/cthackers/adm-zip/releases{/id}","created_at":"2012-02-22T14:06:15Z","updated_at":"2015-02-09T07:58:22Z","pushed_at":"2015-02-09T07:58:21Z","git_url":"git://github.com/cthackers/adm-zip.git","ssh_url":"git@github.com:cthackers/adm-zip.git","clone_url":"https://github.com/cthackers/adm-zip.git","svn_url":"https://github.com/cthackers/adm-zip","homepage":"","size":1068,"stargazers_count":287,"watchers_count":287,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":118,"mirror_url":null,"open_issues_count":44,"forks":118,"open_issues":44,"watchers":287,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cthackers/adm-zip/pulls/96"},"html":{"href":"https://github.com/cthackers/adm-zip/pull/96"},"issue":{"href":"https://api.github.com/repos/cthackers/adm-zip/issues/96"},"comments":{"href":"https://api.github.com/repos/cthackers/adm-zip/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/cthackers/adm-zip/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/cthackers/adm-zip/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cthackers/adm-zip/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/cthackers/adm-zip/statuses/4041cc3b1ecaee66cd835f6d4daa2ed0a9a34ff4"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"cthackers","id":210514,"avatar_url":"https://avatars.githubusercontent.com/u/210514?v=3","gravatar_id":"","url":"https://api.github.com/users/cthackers","html_url":"https://github.com/cthackers","followers_url":"https://api.github.com/users/cthackers/followers","following_url":"https://api.github.com/users/cthackers/following{/other_user}","gists_url":"https://api.github.com/users/cthackers/gists{/gist_id}","starred_url":"https://api.github.com/users/cthackers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cthackers/subscriptions","organizations_url":"https://api.github.com/users/cthackers/orgs","repos_url":"https://api.github.com/users/cthackers/repos","events_url":"https://api.github.com/users/cthackers/events{/privacy}","received_events_url":"https://api.github.com/users/cthackers/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":20,"deletions":5,"changed_files":1}}