File Operations
Download ZIP Archive
DownloadValidateMedium
Description
Download a ZIP archive containing multiple files. Extract and verify the contents.
Test Scenario
// Playwright: Download and verify ZIP
const response = await request.get('/api/v1/files/download?format=zip');
expect(response.headers()['content-type']).toBe('application/zip');
const buffer = await response.body();
// Check ZIP magic bytes (PK)
expect(buffer[0]).toBe(0x50); // P
expect(buffer[1]).toBe(0x4B); // K
// For extraction, use a ZIP library
// const zip = new AdmZip(buffer);
// const entries = zip.getEntries();
// expect(entries.map(e => e.entryName)).toContain('users.csv');Endpoint
/api/v1/files/download?format=zipTesting Tips
- •Check Content-Type is application/zip
- •ZIP files start with PK (0x504B)
- •Use yauzl or adm-zip library to extract
- •Verify expected files are in the archive
// Playwright API Testing - File Operationsimport { test, expect } from '@playwright/test';test('File download', async ({ request }) => {const response = await request.get('/api/files/download/report.pdf');expect(response.ok()).toBeTruthy();expect(response.headers()['content-type']).toContain('application/pdf');const buffer = await response.body();expect(buffer.length).toBeGreaterThan(0);});
Challenge ID: download-zip
2 frameworks available
API Playground
Send requests and inspect responses
Endpoint: /api/v1/files/download?format=zip
Press Enter to send