import { createUploader, createSrc } from '@magicjs.dev/frontend';
import getFileServer from './get-file.server'; // The backend server function for reading files
const fileSrc = createSrc(getFileServer);
return (
<div>
<img src={fileSrc.getLink('fileName.jpg')} alt="File Preview" />
</div>
);
import { createBackendFunction, utils } from '@magicjs.dev/backend';
export default createBackendFunction(async function (fileName: string) {
return utils.readFileFromUserUploads('/path', fileName);
});