You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import fs, { existsSync } from 'fs';
import { move } from 'fs-extra';
import path from 'path';
import { UploadedFile } from 'adminjs';
import { BaseProvider } from '@adminjs/upload';
const UPLOADS_DIR = 'public/files';
export default class UploadProvider extends BaseProvider {
constructor() {
super(UPLOADS_DIR);
if (!existsSync(UPLOADS_DIR)) {
throw new Error( directory: "${UPLOADS_DIR}" does not exists. Create it before running LocalAdapter,
);
}
}
Description
import fs, { existsSync } from 'fs';
import { move } from 'fs-extra';
import path from 'path';
import { UploadedFile } from 'adminjs';
import { BaseProvider } from '@adminjs/upload';
const UPLOADS_DIR = 'public/files';
export default class UploadProvider extends BaseProvider {
constructor() {
super(UPLOADS_DIR);
if (!existsSync(UPLOADS_DIR)) {
throw new Error(
directory: "${UPLOADS_DIR}" does not exists. Create it before running LocalAdapter
,);
}
}
public async upload(file: UploadedFile, key: string): Promise {
const externalId = key.split('/')[0];
const dirPath = path.join(UPLOADS_DIR,
tool_${externalId}
);if (!existsSync(dirPath)) {
await fs.promises.mkdir(dirPath, { recursive: true });
}
}
public async delete(key: string, bucket: string): Promise {
const filePath = path.join(UPLOADS_DIR, key);
await fs.promises.unlink(filePath);
}
// eslint-disable-next-line class-methods-use-this
public path(key: string, bucket?: string): string {
return path.join(UPLOADS_DIR, key);
}
}
And the question is - how should I render downloaded image/images using built-in component suck as File component on the screen.
I didn't get it using documentation.
Suggested Solution
Update documentation for Show downloaded images case
Alternatives
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: