Untitled

mail@pastecode.io avatar
unknown
plain_text
7 days ago
533 B
10
Indexable
Never
const fs = require('fs');

// Replace this with your byte array
const byteArray = [
  // Example byte array (you should replace this with actual data)
  0x25, 0x50, 0x44, 0x46, // %PDF
  // Add more bytes of your PDF data here
];

// Convert byte array to Buffer
const buffer = Buffer.from(byteArray);

// Write the Buffer to a PDF file
fs.writeFile('output.pdf', buffer, (err) => {
  if (err) {
    console.error('Error writing file:', err);
  } else {
    console.log('PDF file created successfully.');
  }
});
Leave a Comment