Buckets:
| import { NextResponse } from 'next/server'; | |
| import fs from 'fs'; | |
| import path from 'path'; | |
| import { getDatasetsRoot } from '@/server/settings'; | |
| export async function POST(request: Request) { | |
| try { | |
| const body = await request.json(); | |
| const { name } = body; | |
| let datasetsPath = await getDatasetsRoot(); | |
| let datasetPath = path.join(datasetsPath, name); | |
| // if folder doesnt exist, ignore | |
| if (!fs.existsSync(datasetPath)) { | |
| return NextResponse.json({ success: true }); | |
| } | |
| // delete it and return success | |
| fs.rmSync(datasetPath, { recursive: true, force: true }); | |
| return NextResponse.json({ success: true }); | |
| } catch (error) { | |
| return NextResponse.json({ error: 'Failed to delete dataset' }, { status: 500 }); | |
| } | |
| } | |
Xet Storage Details
- Size:
- 761 Bytes
- Xet hash:
- 64dd5dc77b33827ece4bc3a1b2ee7e3d06fa16f3f0c3c6c9721aeb935fbf7cf7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.