|
|
2 年之前 | |
|---|---|---|
| .. | ||
| .npmignore | 2 年之前 | |
| .travis.yml | 2 年之前 | |
| README.md | 2 年之前 | |
| index.js | 2 年之前 | |
| package.json | 2 年之前 | |
| test.js | 2 年之前 | |
slicing stream like buffer/string
$ npm install stream-slice --save
var fs = require('fs');
var slice = require('stream-slice').slice;
fs.createReadStream('your path')
.pipe(slice(10, 100))
.on('data', function() {
// here we only get the buffer from 10th to 100th.
});
slicing file
var fs = require('fs');
var slice = require('stream-slice').slice;
fs.createReadStream('sourc file path')
.pipe(slice(0, 200))
.pipe(fs.createWriteStream('dest file path'));
MIT