Sha256: 8725b08ba048d832681920d88285df1fd6c0c3253881df6a483a542cd28f5a37
Contents?: true
Size: 794 Bytes
Versions: 3
Compression:
Stored size: 794 Bytes
Contents
common = require("../common"); assert = common.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.addListener('exit', function() { assert.equal(readCalled, 1); });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rednode-0.1.2 | ext/node/test/simple/test-fs-read-buffer.js |
rednode-0.1.1 | ext/node/test/simple/test-fs-read-buffer.js |
rednode-0.1.0 | ext/node/test/simple/test-fs-read-buffer.js |