Skip to content

Reading content of UTF-8 file using createReadStream #1308

@sitepx

Description

@sitepx

We were using file.createReadStream() on gcloud node api to read a UTF-8 file contents.
In the beginning of the file some special characters broke on the process of concat the contents on "data" event.

We already made a workaround, but we think the createReadStrem needs more options like buffer size, or a function do get a file full content.

To ilustrate how the problem goes:

file.createReadStream()
    .on('data', function(data) {
      // Here may be the problem, like if we have in the first 200 characters of the file a sequence of "ç" they some will broke when reading the content.
      content += data;
    }).on('end', function() {
        // use the file contents on content var
    });

Thanks!

Metadata

Metadata

Labels

api: storageIssues related to the Cloud Storage API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions