Questions tagged [binaryfiles]

A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes.

A binary file is a computer file that is not a text file. It may contain any type of data, encoded in binary form for computer storage and processing purposes.

Many binary file formats contain parts that can be interpreted as text. for example, some computer document files, word file, office files, contain the text of the document but also contain formatting information in binary form.

Source: Wikipedia (Binary file)

2897 questions
1205
votes
33 answers

How can you encode a string to Base64 in JavaScript?

I have a PHP script that can encode a PNG image to a Base64 string. I'd like to do the same thing using JavaScript. I know how to open files, but I'm not sure how to do the encoding. I'm not used to working with binary data.
username
  • 18,800
  • 11
  • 41
  • 45
550
votes
13 answers

Managing large binary files with Git

I am looking for opinions of how to handle large binary files on which my source code (web application) is dependent. We are currently discussing several alternatives: Copy the binary files by hand. Pro: Not sure. Contra: I am strongly against…
pi.
  • 21,112
  • 8
  • 38
  • 59
234
votes
10 answers

How can I save a base64-encoded image to disk?

My Express app is receiving a base64-encoded PNG from the browser (generated from canvas with toDataURL() ) and writing it to a file. But the file isn't a valid image file, and the "file" utility simply identifies it as "data". var body =…
mahemoff
  • 44,526
  • 36
  • 160
  • 222
170
votes
18 answers

What is the best place for storing uploaded images, SQL database or disk file system?

I'm writing an application that allows users to upload images onto the server. I expect about 20 images per day all jpeg and probably not edited/resized. (This is another question, how to resize the images on the server side before storing. Maybe…
Tobias
  • 4,999
  • 7
  • 34
  • 40
168
votes
4 answers

Can I hex edit a file in Visual Studio?

I want to edit a binary file, but I don't want to use another tool other than Visual Studio because it's a pain to switch back and forth. Is there perhaps an add-in or some built in functionality that can do that in Visual Studio?
Kevin Driedger
  • 51,492
  • 15
  • 48
  • 55
142
votes
2 answers

Getting binary content in Node.js using request

I was trying to GET a binary data using request, and had something like: var requestSettings = { method: 'GET', url: url, }; request(requestSettings, function(error, response, body) { // Use body as a binary Buffer } But body was always…
GilZ
  • 6,418
  • 5
  • 30
  • 40
134
votes
1 answer

Transform hexadecimal information to binary using a Linux command

I have this binary file on my Linux system... udit@udit-Dabba ~ $ cat file.enc Salted__s�bO��<0�F���Jw!���]�:`C�LKȆ�l Using the hexdump command, I see its information like this: udit@udit-Dabba ~ $ hexdump -C file.enc 00000000 53 61 6c 74 65…
Udit Gupta
  • 3,162
  • 11
  • 43
  • 71
102
votes
5 answers

How to read a binary file into a vector of unsigned chars

Lately I've been asked to write a function that reads the binary file into the std::vector where BYTE is an unsigned char. Quite quickly I came with something like this: #include #include typedef unsigned char…
LihO
  • 41,190
  • 11
  • 99
  • 167
82
votes
6 answers

diff a directory recursively, ignoring all binary files

Working on a Fedora Constantine box. I am looking to diff two directories recursively to check for source changes. Due to the setup of the project (prior to my own engagement with said project! sigh), the directories contain both source and…
Zéychin
  • 4,135
  • 2
  • 28
  • 27
79
votes
4 answers

How does Git deal with binary files?

Do I have to do something to tell Git whether some files are binary (like in Subversion)? Or, can Git handle binary data automatically? If I change the binary file, so that I have 100 binary revisions, will git just store all 100 versions…
prosseek
  • 182,215
  • 215
  • 566
  • 871
76
votes
11 answers

How do I distinguish between 'binary' and 'text' files?

Informally, most of us understand that there are 'binary' files (object files, images, movies, executables, proprietary document formats, etc) and 'text' files (source code, XML files, HTML files, email, etc). In general, you need to know the…
benno
  • 2,077
  • 1
  • 19
  • 23
76
votes
17 answers

Locking binary files using git version control system

For one and a half years, I have been keeping my eyes on the git community in hopes of making the switch away from SVN. One particular issue holding me back is the inability to lock binary files. Throughout the past year I have yet to see…
Mario
  • 2,229
  • 2
  • 21
  • 21
68
votes
12 answers

How to edit a binary file on Unix systems

On Windows machines there are lots of third-party editors available to edit a binary file. How can I edit a binary file on a Unix system?
Hemant
  • 3,893
  • 6
  • 27
  • 22
65
votes
13 answers

How to check if the file is a binary file and read all the files which are not?

How can I know if a file is a binary file? For example, compiled c file. I want to read all files from some directory, but I want ignore binary files.
Refael
  • 6,753
  • 9
  • 35
  • 54
61
votes
8 answers

Read binary file into a struct

I'm trying to read binary data using C#. I have all the information about the layout of the data in the files I want to read. I'm able to read the data "chunk by chunk", i.e. getting the first 40 bytes of data converting it to a string, get the next…
Robert Höglund
  • 10,010
  • 13
  • 53
  • 70
1
2 3
99 100