-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestore-blob.js
More file actions
29 lines (25 loc) · 851 Bytes
/
restore-blob.js
File metadata and controls
29 lines (25 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { put } = require('@vercel/blob');
const fs = require('fs');
async function restore() {
try {
const data = JSON.parse(fs.readFileSync('./music-storage.json', 'utf8'));
const timestamp = Date.now();
const blob = await put(
`music-data-${timestamp}.json`,
JSON.stringify(data, null, 2),
{
access: 'public',
token: 'vercel_blob_rw_xlBhdcTC4tbc5fRh_MVDKcXH8bSFfTG2UypSgF0nd3D9DI'
}
);
console.log('✅ Successfully restored', data.length, 'songs to Blob storage');
console.log('📦 Blob URL:', blob.url);
console.log('\n🎵 Restored songs:');
data.forEach((song, i) => {
console.log(` ${i + 1}. "${song.title}" by ${song.artist}`);
});
} catch (error) {
console.error('❌ Error:', error.message);
}
}
restore();