MCPcopy Create free account
hub / github.com/dailydotdev/apps / uploadContentImage

Function uploadContentImage

packages/shared/src/graphql/posts.ts:1208–1227  ·  view source on GitHub ↗
(
  image: File,
  onProcessing?: (file: File) => void,
)

Source from the content-addressed store, hash-verified

1206export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`;
1207
1208export const uploadContentImage = async (
1209 image: File,
1210 onProcessing?: (file: File) => void,
1211): Promise<string> => {
1212 if (image.size > allowedFileSize) {
1213 throw new Error(`File size exceeds the limit of ${imageSizeLimitMB} MB`);
1214 }
1215
1216 if (!allowedContentImage.includes(image.type)) {
1217 throw new Error('File type is not allowed');
1218 }
1219
1220 if (onProcessing) {
1221 onProcessing(image);
1222 }
1223
1224 const res = await gqlClient.request(UPLOAD_IMAGE_MUTATION, { image });
1225
1226 return res.uploadContentImage;
1227};
1228
1229export enum PostRelationType {
1230 Collection = 'COLLECTION',

Callers 4

FeedbackModalFunction · 0.90
handleSubmitFunction · 0.90
handleIconBase64Function · 0.90
uploadImageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected