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

Function uploadContentImage

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

Source from the content-addressed store, hash-verified

1169export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`;
1170
1171export const uploadContentImage = async (
1172 image: File,
1173 onProcessing?: (file: File) => void,
1174): Promise<string> => {
1175 if (image.size > allowedFileSize) {
1176 throw new Error(`File size exceeds the limit of ${imageSizeLimitMB} MB`);
1177 }
1178
1179 if (!allowedContentImage.includes(image.type)) {
1180 throw new Error('File type is not allowed');
1181 }
1182
1183 if (onProcessing) {
1184 onProcessing(image);
1185 }
1186
1187 const res = await gqlClient.request(UPLOAD_IMAGE_MUTATION, { image });
1188
1189 return res.uploadContentImage;
1190};
1191
1192export enum PostRelationType {
1193 Collection = 'COLLECTION',

Callers 5

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

Calls

no outgoing calls

Tested by

no test coverage detected