Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6945403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:25:54+00:00 2026-05-27T13:25:54+00:00

I have a php script that generates a binary file (is some kind of

  • 0

I have a php script that generates a binary file (is some kind of compression of a map, doesn’t really matter).
I can save it as an image for example and send it.

What I need now is to make a string from that file. To be more clear… I want to get the bits (ignore the image overhead of course) and the final string must be something like 100101010101111… u get the idea.

Can and if yes how do I do this in javascript?

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:25:55+00:00Added an answer on May 27, 2026 at 1:25 pm

    You can make an AJAX call to retrieve the contents of the file and then use bitwise operators to generate the binary representation string that you are striving for.

    The php script must be accessible through a HTTP request, of course.

    One of the easiest ways to implement a AJAX GET request is to use jQuery.get, which you can read more about here.

    Regarding the generation of a binary representation there are several implementations available online.

    I wrote my own sample implementation of a string to binary converter:

    var data          = "h€llo world ";
    var binary_string = "";
    
    for (var idx in data) {
      var v = data.charCodeAt (idx);
    
      do {
        var b = v & 0xFF;
    
        for (var i =0; i < 8; ++i)
          binary_string += (b & (1<<(7-i))) ? '1' : '0';
    
        binary_string += ' ';
    
      } while (v >>= 8);
    }
    

    binary_string = 01101000 10101100 00100000 01101100 01101100 01101111 00100000 01110111 01101111 01110010 01101100 01100100 00100000

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP script that generates an RSS feed using some external data
I have a Ruby script that generates a sed command to replace some PHP
I have a PHP script on a server that generates the XML data on
I have a script that generates images from text using PHP. It's working fine
I have a PHP script that can encode a PNG image to a Base64
I have a PHP script that processes file uploads. The script tries to organise
I have a PHP script that pushes the headers to allow a file to
I have written a php script that generates a list of links that match
I have a script that generates a csv file using the following code: header('Content-type:
Basically I have a php script located on a sever that generates a JSON

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.