Comments (5)
I don't see what this has to do with byline. You're saying that:
var writeStream = fs.createWriteStream(tmpFilePath, {flags: 'w', encoding: 'utf-8'});
followed by:
writeStream.write(text + os.EOL);
Results in a file without EOL characters. Byline plays no role in that.
from node-byline.
Also you have an inconsistency in your code for the encodings 'utf8' vs 'utf-8'.
from node-byline.
@jahewson sorry, does byline
read the input line in
var stream = byline(fs.createReadStream(self._options.trainFile, { flags: 'r', encoding: 'utf8'}));
So I would expect to write down that line so
stream.on('data', function(text) { /// read line by line
text=text.toLowerCase()
.replace(/^/gm, '__label__')
.replace(/'/g, " ' ")
.replace(/"/g, '')
.replace(/\./g, ' \. ')
.replace(/,/g, ' \, ')
.replace(/\(/g, ' ( ')
.replace(/\)/g, ' ) ')
.replace(/!/g, ' ! ')
.replace(/\?/g, ' ! ')
.replace(/;/g, ' ')
.replace(/:/g, ' ');
writeStream.write(text + '\n');
});
but this is out writing down a new line...
from node-byline.
Ok, so does this:
// ...
stream.on('data', function(text) { /// read line by line
console.log(text)
});
Print only one line to the console?
from node-byline.
@jahewson lines are printed out in the console, but when I write to writeStream.write(text + '\n');
I will get in the output stream one single line, without any \n
appended.
from node-byline.
Related Issues (20)
- support for npm test HOT 3
- Frequent pause/resume on large file causes data loss HOT 8
- question please (insert parsed data to a DB) HOT 1
- Better not to `console.log` while running HOT 4
- README issues! HOT 1
- Read previous/next line? HOT 1
- Browser complains about setImmediate() not being defined HOT 1
- .idea directory in npm package HOT 1
- Doesn't work with codepoint 133 HOT 4
- Undoing byline(streamX) HOT 2
- \x85 is an important part of international characters HOT 1
- linebreak at wrong character
- Calling toString() on potentially incomplete buffers HOT 3
- [Feature request] Ability to skip first line HOT 1
- Does this package work? HOT 3
- DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended HOT 3
- Trailing EOL treated as an additional empty line
- Stop output after one line.
- How does this compare to node.js readline?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-byline.