2010-05-20 02:17:50 +08:00
|
|
|
require('../common');
|
2010-06-11 05:59:06 +08:00
|
|
|
path = require('path'),
|
|
|
|
Buffer = require('buffer').Buffer
|
|
|
|
fs = require('fs')
|
|
|
|
fn = path.join(fixturesDir, 'write.txt');
|
2010-05-20 02:17:50 +08:00
|
|
|
|
2010-06-11 05:59:06 +08:00
|
|
|
|
|
|
|
foo = 'foo'
|
2010-05-20 02:17:50 +08:00
|
|
|
var fd = fs.openSync(fn, 'w');
|
2010-06-11 05:59:06 +08:00
|
|
|
fs.writeSync(fd, foo);
|
|
|
|
|
|
|
|
bar = 'bár'
|
|
|
|
fs.writeSync(fd, new Buffer(bar), 0, Buffer.byteLength(bar));
|
2010-05-20 02:17:50 +08:00
|
|
|
fs.closeSync(fd);
|
|
|
|
|
2010-06-11 05:59:06 +08:00
|
|
|
assert.equal(fs.readFileSync(fn), 'foobár');
|