
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
ghcs (github-cloud-storage) provides a simple interface to read and write blobs to a GitHub repository. The blobs are stored in the repository as files. This library makes use of the GitHub API to read and write blobs.
Here are the references to underlying GitHub API:
$ npm install ghcs
A complete guide for this library can be found here
Here are a few examples that outlines the usage of the ghcs library.
Creating new client
A new client can be created using the ghcs.client.Client class constructor. This constructor requires three properties:
owner - the owner of the repositoryrepository - the repository for which blobs are to be read/writtentoken - personal access token with repo scope// create a new client
const client = new ghcs.client.Client({
owner: 'panchalshubham0608',
repository: 'test-repo',
token: process.env.GITHUB_TOKEN,
});
// retrieve the name of the repository from the client
console.log(`Repository: ${client.repository}`);
// retrieve the name of the owner from the client
console.log(`Owner: ${client.owner}`);
Reading blobs:
All the blob read operations are facilitated by BlobReader and you can get an instance of BlobReader by invoking the NewBlobReader method.
// get an instance of blob reader to facilitate blob reading
const blobReader = client.NewBlobReader();
To read content of a blob you can invoke the GetContent method. Note that this will throw an error of kind ErrKindUnprocessableEntity if the blob at given path is a directory.
// read the content of the blob
blobReader.GetContent('test.txt').then(blobContent => {
console.log(`Content of the blob: ${blobContent.body}`);
console.log(`Size of the blob: ${blobContent.size}`);
}).catch(err => {
console.log(err);
})
In similar fashion you can get the metadata of the blob by invoking GetMetadata(path) provided that the blob at given path corresponds to a file. The ListBlobs(path) method can be used to list the blobs at given path provided that the blob at given path is a directory.
Writing new blobs:
All the blob writing/deletion operations are facilitated by BlobWriter and you can get an instance of a BlobWriter by invoking the NewBlobWriter method.
// get an instance of blob writer to facilitate writing to the repository
const blobWriter = client.NewBlobWriter();
To write content to a blob you can invoke Write(path, content) method which will write the content at given path and in response you get the details of commit created and the metadata of the newly created blob.
Here are a few things to keep in mind while writing blobs:
ErrKindUnprocessableEntityis thrown.// write a file to the repository
blobWriter.Write('test.txt', 'Hello World!').then(resp => {
// response object will contain the commit details and metadata of the blob
const [commit, blobMetadata] = resp;
console.log(`Commit: ${commit.sha}`);
console.log(`Blob: ${blobMetadata.sha}`);
}).catch(err => {
console.log(err);
});
FAQs
Library to interact with GitHub repositories as a cloud-storage service!
We found that ghcs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.