Get the content of the specified file.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('vcs/single-file-content@1.1.1');
// Use the profile
const result = await profile
.getUseCase('SingleFileContent')
.perform({
owner: 'superfaceai',
repo: 'one-sdk-js',
path: '/README.md',
ref: 'c5e4d76'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"owner": "superfaceai",
"repo": "one-sdk-js",
"path": "/README.md",
"ref": "c5e4d76"
}
{
"size": 5,
"content": "0.a4ba399d443d3",
"encoding": "base64"
}