mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 21:35:34 +00:00

The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
27 lines
798 B
JavaScript
27 lines
798 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var path = require('path'),
|
|
Buffer = require('buffer').Buffer,
|
|
fs = require('fs'),
|
|
filepath = path.join(common.fixturesDir, 'x.txt'),
|
|
fd = fs.openSync(filepath, 'r'),
|
|
expected = 'xyz\n',
|
|
bufferAsync = new Buffer(expected.length),
|
|
bufferSync = new Buffer(expected.length),
|
|
readCalled = 0;
|
|
|
|
fs.read(fd, bufferAsync, 0, expected.length, 0, function(err, bytesRead) {
|
|
readCalled++;
|
|
|
|
assert.equal(bytesRead, expected.length);
|
|
assert.deepEqual(bufferAsync, new Buffer(expected));
|
|
});
|
|
|
|
var r = fs.readSync(fd, bufferSync, 0, expected.length, 0);
|
|
assert.deepEqual(bufferSync, new Buffer(expected));
|
|
assert.equal(r, expected.length);
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(readCalled, 1);
|
|
});
|