Positional write to existing file [Linux, NodeJS]

I'm trying to edit an existing binary file using NodeJS.

My code goes something like this:

file = fs.createWriteStream("/path/to/existing/binary/file", {flags: "a"});
file.pos = 256;
file.write(new Buffer([0, 1, 2, 3, 4, 5]));

In OS X, this works as expected (The bytes at 256..261 get replaced with 0..5).

In linux however, the 5 bytes get appended to the end of file. This is also mentioned in the NodeJS API Reference:

On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

How do I get around this?

Open with a mode of r+ instead of a. r+ is the portable way to say that you want to read and/or write to arbitrary positions in the file, and that the file should already exist.