Files
cnb/test/git.ts
2026-02-02 04:46:21 +08:00

32 lines
871 B
TypeScript

import { Git } from '../src/git/index.ts'
import { token, cookie, showMore } from './common.ts';
const git = new Git({ token, cookie });
const repo = 'kevisual/cnb';
const listFiles = async () => {
// const res = await git.getContentWithPath(repo, 'README.md');
// console.log("res", showMore(res));
const res2 = await git.getContentWithPath(repo, 'src/issue');
console.log("res2", showMore(res2));
const res3 = await git.getContentWithPath(repo, 'src/issue/index.ts');
console.log("res3", showMore(res3));
}
// listFiles();
const createBlob = async () => {
const res = await git.createBlob(repo, {
content: 'Hello, CNB!',
encoding: 'utf-8',
});
console.log("createBlob res", showMore(res));
}
createBlob();
const getRaw = async () => {
const res = await git.getRaw(repo, 'main:README.md');
console.log("getRaw res", showMore(res));
}