MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / thisGetFileFromS3

Function thisGetFileFromS3

apps/web/services/slack/syncWithFiles.ts:116–134  ·  view source on GitHub ↗
(fileLocation: string)

Source from the content-addressed store, hash-verified

114}
115
116async function thisGetFileFromS3(fileLocation: string) {
117 return new Promise(async (res, rej) => {
118 try {
119 const target = tmpdir() + '/' + v4();
120 fs.mkdirSync(target, { recursive: true });
121 const response = await axios({
122 url: encodeURI(fileLocation),
123 method: 'get',
124 responseType: 'stream',
125 });
126 response.data.pipe(fs.createWriteStream(target + '/file.zip'));
127 response.data.on('end', () => {
128 res(target + '/file.zip');
129 });
130 } catch (error) {
131 rej(error);
132 }
133 });
134}
135
136async function thisExtractIntoTemp(file: any) {
137 const target = tmpdir() + '/' + v4();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected