1.0.0 • Published 4 years ago
web-slicer v1.0.0
It's good, it's simple
Install
npm install web-slicer
use
const slice = new Slicer(file)
slice.on('chunk', (chunk, next) => {
//next('msg') passing in an argument indicates cancellation
next()
})
slice.on('end', () => {
console.log('end')
})
slice.on('cancel', (msg) => {
console.log(msg)
})
slice.on('error', (err) => {
console.log(err)
})
//Triggered only when completed correctly
slice.on('finish', () => {
console.log('finish')
})
//Start slicing. Run Buffer is stream cutting
slice.run_buffer() // or slice.run_blobs()
//slice.cancel()
and
不要在不需要使用buffer的情况下采用run_buffer
Don't use run_buffer
when you don't need to use buffer
1.0.0
4 years ago