code
DveloxSoft Bucket Guías de integración para desarrolladores

Archivos comprimidos

Comprime archivos en archivos ZIP, descomprime archivos existentes e inspecciona el contenido de ZIP sin extraerlo.

Listar archivos dentro de un ZIP

Llama a GET /files/:containerSlug/zip-contents con la ruta del archivo para listar su contenido sin descomprimirlo.

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');
}

Comprimir archivos en ZIP

Envía POST /files/:containerSlug/compress con un array de rutas de origen y un nombre de archivo de salida.

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');

Descomprimir un archivo ZIP

Envía POST /files/:containerSlug/decompress con la ruta del archivo.

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');