MCPcopy Create free account
hub / github.com/FxEmbed/FxEmbed / pull

Function pull

tools/credential-tools.mjs:196–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194}
195
196async function pull() {
197 const env = requireR2S3Credentials('pull');
198 const client = createR2S3Client(env);
199 const out = await client.send(new GetObjectCommand({ Bucket: env.bucket, Key: env.key }));
200 if (!out.Body) {
201 console.error('R2 GetObject returned an empty body.');
202 process.exit(1);
203 }
204 const buf = Buffer.from(await out.Body.transformToByteArray());
205 writeFileSync(ENCRYPTED_PATH, buf);
206 console.error(`Wrote ${ENCRYPTED_PATH}`);
207}
208
209const cmd = process.argv[2];
210if (cmd === 'encrypt') {

Callers 1

Calls 2

requireR2S3CredentialsFunction · 0.85
createR2S3ClientFunction · 0.85

Tested by

no test coverage detected