JSPM

last-bytes

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q50536F
  • License MIT

Keep the last count bytes of a stream around

Package Exports

  • last-bytes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (last-bytes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SYNOPSIS

Keep the last count bytes around from a stream.

EXAMPLE

var lastBytes = require('last-bytes')
var spawn = require('child_proc').spawn

var ps = child_proc.spawn(...)
// keep 1024 bytes around from the stream, at given time only that much
var stderrBuf = lastBytes(1024, ps.stderr)

// at any given time we can inspect the last 1K of stderr:
setTimeout(() => {
  console.log(stderrBuf.toString()))
}, 1000)

Note

Interface is still in flux thus < 1.0.0. I'm not happy about passing the source in as an argument. I feel like we should just return a stream-like that you can pipe into but also call something like .read or something.