Download spectrum/api/mutations/files/uploadImage.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 571 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/mutations/files/uploadImage.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/api/mutations/files/uploadImage.js
-
curl -L -o uploadImage.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/mutations/files/uploadImage.js
571 Bytes
| // @flow | |
| import { isAuthedResolver } from '../../utils/permissions'; | |
| import { uploadImage } from '../../utils/file-storage'; | |
| import type { EntityTypes } from 'shared/types'; | |
| import type { FileUpload } from 'shared/types'; | |
| import { signImageUrl } from 'shared/imgix'; | |
| type Args = { | |
| input: { | |
| image: FileUpload, | |
| type: EntityTypes, | |
| id?: string, | |
| }, | |
| }; | |
| export default isAuthedResolver(async (_: void, { input }: Args) => { | |
| const { image, type, id } = input; | |
| const url = await uploadImage(image, type, id || 'draft'); | |
| return await signImageUrl(url); | |
| }); | |