Skip to content

fs.writeSync truncates long lines #1541

Closed
@segrey

Description

iojs 1.8.1
Linux Mint 17, x64, 3.13.0-24

function formatString(n) {
  var str = '';
  while (str.length < n) {
    str = str + ' ' + str.length;
  }
  return str;
}

var fs = require('fs')
  , str = formatString(100000)
  , buffer = new Buffer(str + '\n', 'utf8');

fs.writeSync(process.stdout.fd, buffer, 0, buffer.length, null);

Running this script produces a truncated output. Here is a tail of it ... 77530 77536 77542 77548 77554 77560 7.

Replacing fs.writeSync(process.stdout.fd, buffer, 0, buffer.length, null) with console.log(str) changes output. Now the full string is output correctly. Tail is ... 9964 99970 99976 99982 99988 99994.

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.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