Archives
Compress files into ZIP archives, decompress existing archives, and inspect ZIP contents without extracting them.
List files inside a ZIP archive
Call GET /files/:containerSlug/zip-contents with the archive path to list its contents without decompressing it.
typescript
const response = await fetch(
`https://bucket.dveloxsoft.com/api/files/${containerSlug}/zip-contents?archive=${encodeURIComponent('path/to/archive.zip')}`,
{
headers: {
'Authorization': 'ApiKey <api_key>'
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.message || 'Failed to list ZIP contents');
}
const entries = await response.json();
for (const entry of entries) {
console.log(entry.path, entry.size, 'bytes');
} Compress files into ZIP
Send POST /files/:containerSlug/compress with an array of source paths and an output archive name.
typescript
const response = await fetch(
`https://bucket.dveloxsoft.com/api/files/${containerSlug}/compress`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'ApiKey <api_key>'
},
body: JSON.stringify({
filePaths: ['path/to/a.jpg', 'path/to/b.png'],
outputName: 'archive.zip'
})
}
);
const result = await response.json();
console.log('Created ZIP:', result.path, result.size, 'bytes'); Decompress a ZIP archive
Send POST /files/:containerSlug/decompress with the archive path.
typescript
const response = await fetch(
`https://bucket.dveloxsoft.com/api/files/${containerSlug}/decompress`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'ApiKey <api_key>'
},
body: JSON.stringify({
archivePath: 'path/to/archive.zip'
})
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.message || 'Failed to decompress');
}
console.log('Archive decompressed');