Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-automations/git-file-utils

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-automations/git-file-utils

Utilities for github file operation

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
190K
decreased by-34.47%
Maintainers
1
Weekly downloads
 
Created
Source

git-file-utils

This is a small library for handling git files. Currently it only provides RepositoryFileCache which is a read-through cache for a single branch. Because this library uses GIt Data API, it can fetch files up to 100 MB of size.

Install

npm i @google-automations/git-file-utils

Fetch a file

import {Octokit} from '@octokit/rest';
import {
  FileNotFoundError,
  RepositoryFileCache
} from '@google-automations/git-file-utils';

const octokit = new Octokit();
const cache = new RepositoryFileCache(
  octokit,
  {
    owner: "googleapis",
    repo: "repo-automation-bots",
  });
try {
  const contents = await cache.getFileContents("README.md", "main");
  console.log(`content: ${contents.parsedContent}`);
} catch (e) {
  if (e instanceof FileNotFoundError) {
    console.log(`file not found`);
  } else {
    // rethrow
    throw e;
  }
}

Keywords

FAQs

Package last updated on 18 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc