Skip to content

Change in fs.statSync behavior between 7.1.0 and 7.2.0 #10242

Closed
@sharkinsspatial

Description

@sharkinsspatial
  • Version: 7.1.0 & 7.2.0
  • Platform: OSX 10.9.5
  • Subsystem: fs

I noted a change in behavior between fs.statSync when migrating between 7.1.0 and 7.2.0. With
7.1.0 the following code reports a file size of 0.

var fs = require('fs');

var buffer = new Buffer(16);
buffer.fill(0);

fd = fs.openSync('test', 'a');
fs.writeSync(fd, buffer);
fs.fsyncSync(fd);
fs.closeSync(fd);

var stats = fs.statSync('./test');
console.log(stats['size']);
fs.unlinkSync('test');

While using 7.2.0 it reports a file size of 16.

Interestingly using appendFileSync rather than opening file handles is not affected by version differences. The Changelog notes a libuv upgrade between the two versions but I'm unsure what could produce this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions