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

Function uploadContentImage

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

Source from the content-addressed store, hash-verified

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