Skip to content

Conversation

@Danny-Dasilva
Copy link
Owner

@Danny-Dasilva Danny-Dasilva commented Aug 12, 2025

2.0.3 - (11-12-2025)

Release Highlights

Enhanced Binary Data Support, Cookie Jar Documentation & HTTP/3 Protocol Documentation

Enhancements

  • Binary Request Support - Added BodyBytes []byte field to Options struct for sending binary data without string conversion overhead
  • Binary Response Support - Added BodyBytes []byte field to Response struct for accessing raw binary response data
  • Memory Optimization - Direct byte handling eliminates string conversion overhead for binary content like images, files, and other binary data

Bug Fixes

Examples

Binary Data Support:

// Upload binary image data
imageData, _ := os.ReadFile("image.jpg")
response, err := client.Do("https://api.example.com/upload", cycletls.Options{
    BodyBytes: imageData,  // Direct binary upload
    Headers: map[string]string{"Content-Type": "image/jpeg"},
}, "POST")

// Access binary response data  
downloadResp, _ := client.Do("https://api.example.com/download", cycletls.Options{}, "GET")
binaryData := downloadResp.BodyBytes  // Raw []byte data
stringData := downloadResp.Body       // Same data as string (backward compatibility)

JavaScript/TypeScript Binary Data Support:

const initCycleTLS = require('cycletls');
const fs = require('fs');

(async () => {
  const cycleTLS = await initCycleTLS();

  // Upload binary image data
  const imageData = fs.readFileSync('image.jpg');
  const uploadResponse = await cycleTLS('https://api.example.com/upload', {
    body: imageData.toString('binary'), // Convert Buffer to binary string
    headers: { 'Content-Type': 'image/jpeg' }
  }, 'POST');

  // Download binary data using arrayBuffer()
  const downloadResponse = await cycleTLS('https://api.example.com/download');
  const binaryData = await downloadResponse.arrayBuffer(); // Clean binary data
  const buffer = Buffer.from(binaryData);
  fs.writeFileSync('downloaded-file.jpg', buffer);

  cycleTLS.exit();
})();

@Danny-Dasilva Danny-Dasilva changed the title Release: Fix Ja4 Parsing and add Binary support [2.0.3] Release: ✨ Fix Ja4 Parsing and add Binary support [2.0.3] Aug 12, 2025
@Danny-Dasilva Danny-Dasilva merged commit 5d616eb into main Aug 12, 2025
3 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants