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

Function uploadContentImage

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

Source from the content-addressed store, hash-verified

1254export const uploadNotAcceptedMessage = `File type is not allowed or the size exceeded the limit of ${imageSizeLimitMB} MB`;
1255
1256export const uploadContentImage = async (
1257 image: File,
1258 onProcessing?: (file: File) => void,
1259): Promise<string> => {
1260 if (image.size > allowedFileSize) {
1261 throw new Error(`File size exceeds the limit of ${imageSizeLimitMB} MB`);
1262 }
1263
1264 if (!allowedContentImage.includes(image.type)) {
1265 throw new Error('File type is not allowed');
1266 }
1267
1268 if (onProcessing) {
1269 onProcessing(image);
1270 }
1271
1272 const res = await gqlClient.request(UPLOAD_IMAGE_MUTATION, { image });
1273
1274 return res.uploadContentImage;
1275};
1276
1277export enum PostRelationType {
1278 Collection = 'COLLECTION',

Callers 4

FeedbackModalFunction · 0.90
addFilesFunction · 0.90
handleIconBase64Function · 0.90
uploadImageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected