We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node-binary has a method .scan:
.scan
var b = binary() .scan('line', new Buffer('\r\n')) .tap(function (vars) { console.log(vars.line) });
I'll be happy to propose a PR to add this if @deoxxa thinks it's a good idea.
The text was updated successfully, but these errors were encountered:
Here is a basic implementation:
function scan(name, search) { search = new Buffer(search, 'utf8'); var result = new Buffer(''); return this.loop(function(end) { this.buffer('tmpSearch', 1) .tap(function() { var c = this.vars.tmpSearch; result = Buffer.concat([result, c]); var toSearch = result.slice(-search.length); if (toSearch.compare(search) === 0) { delete this.vars.tmpSearch; this.vars[name] = result.slice(0, -search.length); end(); } }); }); }
Sorry, something went wrong.
No branches or pull requests
node-binary has a method
.scan
:I'll be happy to propose a PR to add this if @deoxxa thinks it's a good idea.
The text was updated successfully, but these errors were encountered: