delimit-stream

2019-08-16

delimit-stream是什么

什么是delimit-stream,Push messages from a stream partitioned by the given delimiter

delimit-stream使用教程帮助文档

build statusdependency statusnpm version">delimit-stream Build StatusDependency StatusNPM version

Push messages from a stream partitioned by the given delimiter

Install

npm install delimit-stream

Example

var DelimitStream = require('delimit-stream')
var net = require('net')

net.createServer(function(socket){
  var delimitStream = new DelimitStream('\r\n', { objectMode: true })
  socket
    .pipe(delimitStream)
    .on('data', function(message){
      console.log('Got message: %j', message)
    })
})

API

DelimitStream(delimiter, [options])

delimiter<String>The character(s) that define the delimiter. DelimitStream will push its buffer every time this delimiter is found in the stream

options<Object>The stream.Transform options. DelimitStream does not add any new options.

Run Tests

npm test

上一篇:is-circular
下一篇:json-text-sequence
相关教程
关注微信

扫码加入 JavaScript 社区

相关文章

首次访问,需要验证
微信扫码,关注即可
(仅需验证一次)

欢迎加入 JavaScript 社区

号内回复关键字:

回到顶部