{"action":"created","comment":{"url":"https://api.github.com/repos/prey/prey-node-client/pulls/comments/62255058","id":62255058,"diff_hunk":"@@ -9,41 +9,42 @@ var join      = require('path').join,\n var logger   = common.logger;\n var watching  = false;\n \n-var files_path = join(common.system.paths.config, 'files.db');\n-storage.init(files_path);\n+// var files_path = join(common.system.paths.config, 'files.db');\n+// storage.init(files_path);\n \n-\n-exports.store = function(id, path, user) {\n-  if (!user) return;\n-  logger.debug('Storing file_id in DB: ' + id);\n-  var opts = {\n-    path: path,\n-    user: user\n-  }\n-  storage.set(id, opts);\n-}\n-\n-exports.del = function(id) {\n-  logger.debug('Removing file id from DB: ' + id);\n-  storage.del(id);\n-}\n-\n-exports.show = function() {\n+var exist = function(id, cb) {\n+  var key = \"fr/\"+id\n   storage.all(function(err, files) {\n     if (err)\n       return logger.error(err.message);\n+    if (files[key]) \n+      return cb(true);\n+    else\n+      return cb(false);\n+  })\n+}\n \n-    var count = Object.keys(files).length;\n-    if (count <= 0)\n+exports.store = function(id, path, size, user) {\n+  exist(id, function(cb) {\n+    if (cb == false) {\n+      logger.debug('Storing file_id in DB: ' + id);\n+      var opts = {\n+        path: path,\n+        size: size,\n+        user: user\n+      }\n+      storage.set(\"fr/\"+id, opts);","path":"lib/agent/actions/fileretrieval/files_storage.js","position":36,"original_position":49,"commit_id":"e220473aae55195e60109ca0d5c91e319fe126df","original_commit_id":"e220473aae55195e60109ca0d5c91e319fe126df","user":{"login":"raliste","id":388935,"avatar_url":"https://avatars.githubusercontent.com/u/388935?v=3","gravatar_id":"","url":"https://api.github.com/users/raliste","html_url":"https://github.com/raliste","followers_url":"https://api.github.com/users/raliste/followers","following_url":"https://api.github.com/users/raliste/following{/other_user}","gists_url":"https://api.github.com/users/raliste/gists{/gist_id}","starred_url":"https://api.github.com/users/raliste/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raliste/subscriptions","organizations_url":"https://api.github.com/users/raliste/orgs","repos_url":"https://api.github.com/users/raliste/repos","events_url":"https://api.github.com/users/raliste/events{/privacy}","received_events_url":"https://api.github.com/users/raliste/received_events","type":"User","site_admin":false},"body":"I would use a constant such as `NAMESPACE` within this file, so that you call storage methods like `storage.set(NAMESPACE + id)` where `NAMESPACE` is `fr/`","created_at":"2016-05-05T21:04:57Z","updated_at":"2016-05-05T21:04:57Z","html_url":"https://github.com/prey/prey-node-client/pull/184#discussion_r62255058","pull_request_url":"https://api.github.com/repos/prey/prey-node-client/pulls/184","_links":{"self":{"href":"https://api.github.com/repos/prey/prey-node-client/pulls/comments/62255058"},"html":{"href":"https://github.com/prey/prey-node-client/pull/184#discussion_r62255058"},"pull_request":{"href":"https://api.github.com/repos/prey/prey-node-client/pulls/184"}}},"pull_request":{"url":"https://api.github.com/repos/prey/prey-node-client/pulls/184","id":55388806,"html_url":"https://github.com/prey/prey-node-client/pull/184","diff_url":"https://github.com/prey/prey-node-client/pull/184.diff","patch_url":"https://github.com/prey/prey-node-client/pull/184.patch","issue_url":"https://api.github.com/repos/prey/prey-node-client/issues/184","number":184,"state":"open","locked":false,"title":"Filebrowser dev","user":{"login":"javo","id":11738416,"avatar_url":"https://avatars.githubusercontent.com/u/11738416?v=3","gravatar_id":"","url":"https://api.github.com/users/javo","html_url":"https://github.com/javo","followers_url":"https://api.github.com/users/javo/followers","following_url":"https://api.github.com/users/javo/following{/other_user}","gists_url":"https://api.github.com/users/javo/gists{/gist_id}","starred_url":"https://api.github.com/users/javo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javo/subscriptions","organizations_url":"https://api.github.com/users/javo/orgs","repos_url":"https://api.github.com/users/javo/repos","events_url":"https://api.github.com/users/javo/events{/privacy}","received_events_url":"https://api.github.com/users/javo/received_events","type":"User","site_admin":false},"body":"Fixes for fileretrieval including depth and maxBuffer","created_at":"2016-01-07T20:53:17Z","updated_at":"2016-05-05T21:04:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00eede328aafbea75430d3da3937205a879bdf76","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/prey/prey-node-client/pulls/184/commits","review_comments_url":"https://api.github.com/repos/prey/prey-node-client/pulls/184/comments","review_comment_url":"https://api.github.com/repos/prey/prey-node-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prey/prey-node-client/issues/184/comments","statuses_url":"https://api.github.com/repos/prey/prey-node-client/statuses/e220473aae55195e60109ca0d5c91e319fe126df","head":{"label":"prey:filebrowser-dev","ref":"filebrowser-dev","sha":"e220473aae55195e60109ca0d5c91e319fe126df","user":{"login":"prey","id":833975,"avatar_url":"https://avatars.githubusercontent.com/u/833975?v=3","gravatar_id":"","url":"https://api.github.com/users/prey","html_url":"https://github.com/prey","followers_url":"https://api.github.com/users/prey/followers","following_url":"https://api.github.com/users/prey/following{/other_user}","gists_url":"https://api.github.com/users/prey/gists{/gist_id}","starred_url":"https://api.github.com/users/prey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prey/subscriptions","organizations_url":"https://api.github.com/users/prey/orgs","repos_url":"https://api.github.com/users/prey/repos","events_url":"https://api.github.com/users/prey/events{/privacy}","received_events_url":"https://api.github.com/users/prey/received_events","type":"Organization","site_admin":false},"repo":{"id":3743084,"name":"prey-node-client","full_name":"prey/prey-node-client","owner":{"login":"prey","id":833975,"avatar_url":"https://avatars.githubusercontent.com/u/833975?v=3","gravatar_id":"","url":"https://api.github.com/users/prey","html_url":"https://github.com/prey","followers_url":"https://api.github.com/users/prey/followers","following_url":"https://api.github.com/users/prey/following{/other_user}","gists_url":"https://api.github.com/users/prey/gists{/gist_id}","starred_url":"https://api.github.com/users/prey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prey/subscriptions","organizations_url":"https://api.github.com/users/prey/orgs","repos_url":"https://api.github.com/users/prey/repos","events_url":"https://api.github.com/users/prey/events{/privacy}","received_events_url":"https://api.github.com/users/prey/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prey/prey-node-client","description":"Node.js client for the Prey anti-theft software.","fork":false,"url":"https://api.github.com/repos/prey/prey-node-client","forks_url":"https://api.github.com/repos/prey/prey-node-client/forks","keys_url":"https://api.github.com/repos/prey/prey-node-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prey/prey-node-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prey/prey-node-client/teams","hooks_url":"https://api.github.com/repos/prey/prey-node-client/hooks","issue_events_url":"https://api.github.com/repos/prey/prey-node-client/issues/events{/number}","events_url":"https://api.github.com/repos/prey/prey-node-client/events","assignees_url":"https://api.github.com/repos/prey/prey-node-client/assignees{/user}","branches_url":"https://api.github.com/repos/prey/prey-node-client/branches{/branch}","tags_url":"https://api.github.com/repos/prey/prey-node-client/tags","blobs_url":"https://api.github.com/repos/prey/prey-node-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prey/prey-node-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prey/prey-node-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/prey/prey-node-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prey/prey-node-client/statuses/{sha}","languages_url":"https://api.github.com/repos/prey/prey-node-client/languages","stargazers_url":"https://api.github.com/repos/prey/prey-node-client/stargazers","contributors_url":"https://api.github.com/repos/prey/prey-node-client/contributors","subscribers_url":"https://api.github.com/repos/prey/prey-node-client/subscribers","subscription_url":"https://api.github.com/repos/prey/prey-node-client/subscription","commits_url":"https://api.github.com/repos/prey/prey-node-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/prey/prey-node-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/prey/prey-node-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/prey/prey-node-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/prey/prey-node-client/contents/{+path}","compare_url":"https://api.github.com/repos/prey/prey-node-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prey/prey-node-client/merges","archive_url":"https://api.github.com/repos/prey/prey-node-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prey/prey-node-client/downloads","issues_url":"https://api.github.com/repos/prey/prey-node-client/issues{/number}","pulls_url":"https://api.github.com/repos/prey/prey-node-client/pulls{/number}","milestones_url":"https://api.github.com/repos/prey/prey-node-client/milestones{/number}","notifications_url":"https://api.github.com/repos/prey/prey-node-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prey/prey-node-client/labels{/name}","releases_url":"https://api.github.com/repos/prey/prey-node-client/releases{/id}","deployments_url":"https://api.github.com/repos/prey/prey-node-client/deployments","created_at":"2012-03-16T21:09:27Z","updated_at":"2016-05-02T07:56:22Z","pushed_at":"2016-05-05T19:01:45Z","git_url":"git://github.com/prey/prey-node-client.git","ssh_url":"git@github.com:prey/prey-node-client.git","clone_url":"https://github.com/prey/prey-node-client.git","svn_url":"https://github.com/prey/prey-node-client","homepage":"http://preyproject.com","size":23522,"stargazers_count":201,"watchers_count":201,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":74,"forks":55,"open_issues":74,"watchers":201,"default_branch":"master"}},"base":{"label":"prey:master","ref":"master","sha":"25147be77a4b068225fe76f27601e5d887869406","user":{"login":"prey","id":833975,"avatar_url":"https://avatars.githubusercontent.com/u/833975?v=3","gravatar_id":"","url":"https://api.github.com/users/prey","html_url":"https://github.com/prey","followers_url":"https://api.github.com/users/prey/followers","following_url":"https://api.github.com/users/prey/following{/other_user}","gists_url":"https://api.github.com/users/prey/gists{/gist_id}","starred_url":"https://api.github.com/users/prey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prey/subscriptions","organizations_url":"https://api.github.com/users/prey/orgs","repos_url":"https://api.github.com/users/prey/repos","events_url":"https://api.github.com/users/prey/events{/privacy}","received_events_url":"https://api.github.com/users/prey/received_events","type":"Organization","site_admin":false},"repo":{"id":3743084,"name":"prey-node-client","full_name":"prey/prey-node-client","owner":{"login":"prey","id":833975,"avatar_url":"https://avatars.githubusercontent.com/u/833975?v=3","gravatar_id":"","url":"https://api.github.com/users/prey","html_url":"https://github.com/prey","followers_url":"https://api.github.com/users/prey/followers","following_url":"https://api.github.com/users/prey/following{/other_user}","gists_url":"https://api.github.com/users/prey/gists{/gist_id}","starred_url":"https://api.github.com/users/prey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prey/subscriptions","organizations_url":"https://api.github.com/users/prey/orgs","repos_url":"https://api.github.com/users/prey/repos","events_url":"https://api.github.com/users/prey/events{/privacy}","received_events_url":"https://api.github.com/users/prey/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prey/prey-node-client","description":"Node.js client for the Prey anti-theft software.","fork":false,"url":"https://api.github.com/repos/prey/prey-node-client","forks_url":"https://api.github.com/repos/prey/prey-node-client/forks","keys_url":"https://api.github.com/repos/prey/prey-node-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prey/prey-node-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prey/prey-node-client/teams","hooks_url":"https://api.github.com/repos/prey/prey-node-client/hooks","issue_events_url":"https://api.github.com/repos/prey/prey-node-client/issues/events{/number}","events_url":"https://api.github.com/repos/prey/prey-node-client/events","assignees_url":"https://api.github.com/repos/prey/prey-node-client/assignees{/user}","branches_url":"https://api.github.com/repos/prey/prey-node-client/branches{/branch}","tags_url":"https://api.github.com/repos/prey/prey-node-client/tags","blobs_url":"https://api.github.com/repos/prey/prey-node-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prey/prey-node-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prey/prey-node-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/prey/prey-node-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prey/prey-node-client/statuses/{sha}","languages_url":"https://api.github.com/repos/prey/prey-node-client/languages","stargazers_url":"https://api.github.com/repos/prey/prey-node-client/stargazers","contributors_url":"https://api.github.com/repos/prey/prey-node-client/contributors","subscribers_url":"https://api.github.com/repos/prey/prey-node-client/subscribers","subscription_url":"https://api.github.com/repos/prey/prey-node-client/subscription","commits_url":"https://api.github.com/repos/prey/prey-node-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/prey/prey-node-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/prey/prey-node-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/prey/prey-node-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/prey/prey-node-client/contents/{+path}","compare_url":"https://api.github.com/repos/prey/prey-node-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prey/prey-node-client/merges","archive_url":"https://api.github.com/repos/prey/prey-node-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prey/prey-node-client/downloads","issues_url":"https://api.github.com/repos/prey/prey-node-client/issues{/number}","pulls_url":"https://api.github.com/repos/prey/prey-node-client/pulls{/number}","milestones_url":"https://api.github.com/repos/prey/prey-node-client/milestones{/number}","notifications_url":"https://api.github.com/repos/prey/prey-node-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prey/prey-node-client/labels{/name}","releases_url":"https://api.github.com/repos/prey/prey-node-client/releases{/id}","deployments_url":"https://api.github.com/repos/prey/prey-node-client/deployments","created_at":"2012-03-16T21:09:27Z","updated_at":"2016-05-02T07:56:22Z","pushed_at":"2016-05-05T19:01:45Z","git_url":"git://github.com/prey/prey-node-client.git","ssh_url":"git@github.com:prey/prey-node-client.git","clone_url":"https://github.com/prey/prey-node-client.git","svn_url":"https://github.com/prey/prey-node-client","homepage":"http://preyproject.com","size":23522,"stargazers_count":201,"watchers_count":201,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":74,"forks":55,"open_issues":74,"watchers":201,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prey/prey-node-client/pulls/184"},"html":{"href":"https://github.com/prey/prey-node-client/pull/184"},"issue":{"href":"https://api.github.com/repos/prey/prey-node-client/issues/184"},"comments":{"href":"https://api.github.com/repos/prey/prey-node-client/issues/184/comments"},"review_comments":{"href":"https://api.github.com/repos/prey/prey-node-client/pulls/184/comments"},"review_comment":{"href":"https://api.github.com/repos/prey/prey-node-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prey/prey-node-client/pulls/184/commits"},"statuses":{"href":"https://api.github.com/repos/prey/prey-node-client/statuses/e220473aae55195e60109ca0d5c91e319fe126df"}}}}