{"name":"@google-automations/git-file-utils","version":"3.0.0","keywords":["Git data API"],"author":{"name":"Jeff Ching","email":"chingor@google.com"},"license":"Apache-2.0","_id":"@google-automations/git-file-utils@3.0.0","maintainers":[{"name":"google-wombot","email":"node-team-npm+wombot@google.com"}],"homepage":"https://github.com/googleapis/repo-automation-bots","bugs":{"url":"https://github.com/googleapis/repo-automation-bots/issues"},"dist":{"shasum":"8cfd05c0986251bbef85fa9e245ddfa45642cd20","tarball":"http://registry-npm.ywwl.com/@google-automations/git-file-utils/download/@google-automations/git-file-utils-3.0.0.tgz","fileCount":7,"integrity":"sha512-e+WLoKR0TchIhKsSDOnd/su171eXKAAdLpP2tS825UAloTgfYus53kW8uKoVj9MAsMjXGXsJ2s1ASgjq81xVdA==","signatures":[{"sig":"MEUCIQCD7cBOC1C2+QqA9ALtl7CJXLZ7JsjhhThDlCnQ2xC+FAIgbryqT6rr5ImTw7lgVt1Sxr0xxv/VIEEJHtfSv/lWM4c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50583,"size":12141,"noattachment":false,"key":"/@google-automations/git-file-utils/-/@google-automations/git-file-utils-3.0.0.tgz"},"main":"./build/src/git-file-utils.js","_from":"file:google-automations-git-file-utils-3.0.0.tgz","engines":{"node":">= 18"},"scripts":{"fix":"gts fix","lint":"gts check","test":"cross-env NODE_ENV=test LOG_LEVEL=fatal c8 mocha --node-option no-experimental-fetch ./build/test","compile":"tsc -p .","prepare":"npm run compile","pretest":"npm run compile","test:snap":"SNAPSHOT_UPDATE=1 npm test","system-test":"npm run pretest && cross-env LOG_LEVEL=fatal mocha ./build/test/integration"},"_npmUser":{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},"_resolved":"","_integrity":"","repository":{"url":"git+https://github.com/googleapis/repo-automation-bots.git","type":"git"},"_npmVersion":"6.14.18","description":"Utilities for github file operation","directories":{},"_nodeVersion":"14.21.3","dependencies":{"minimatch":"^5.1.0","@octokit/rest":"^20.1.1","@octokit/types":"^13.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.12.0","gts":"^4.0.0","chai":"^4.3.6","nock":"^13.2.9","mocha":"^10.0.0","sinon":"^15.0.0","dotenv":"^16.0.2","cross-env":"^7.0.3","node-fetch":"^2.7.0","typescript":"^4.9.4","@types/chai":"^4.3.3","@types/node":"^18.7.15","@types/mocha":"^10.0.0","@types/sinon":"^10.0.13","snap-shot-it":"^7.9.6","@types/minimatch":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/git-file-utils_3.0.0_1740614157017_0.8220855678488928","host":"s3://npm-registry-packages-npm-production"},"readme":"# git-file-utils\n\nThis is a small library for handling git files. Currently it only provides\n`RepositoryFileCache` which is a read-through cache for a single branch. Because\nthis library uses GIt Data API, it can fetch files up to 100 MB of size.\n\n## Install\n\n```bash\nnpm i @google-automations/git-file-utils\n```\n\n## Fetch a file\n\n```typescript\nimport {Octokit} from '@octokit/rest';\nimport {\n  FileNotFoundError,\n  RepositoryFileCache\n} from '@google-automations/git-file-utils';\n\nconst octokit = new Octokit();\nconst cache = new RepositoryFileCache(\n  octokit,\n  {\n    owner: \"googleapis\",\n    repo: \"repo-automation-bots\",\n  });\ntry {\n  const contents = await cache.getFileContents(\"README.md\", \"main\");\n  console.log(`content: ${contents.parsedContent}`);\n} catch (e) {\n  if (e instanceof FileNotFoundError) {\n    console.log(`file not found`);\n  } else {\n    // rethrow\n    throw e;\n  }\n}\n```\n","publish_time":1740614157233,"_cnpm_publish_time":1740614157233,"dist-tags":{"latest":"3.2.1"}}