Skip to content
/ as-buffer Public

Convert a stream (or string, array) to buffer

Notifications You must be signed in to change notification settings

caub/as-buffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read stream and other types as buffer*

npm version build status coverage status

const read = require('as-buffer');

const stream = fs.createReadStream('./photo.png');

read(stream, { maxsize: 1e6 }) // with a max-size, default to 1e7, 10MiB
	.then(buf => console.log('read', buf))
	.catch(e => console.log('file too large'));

*: exception of object-mode streams that are returned as array

like https://github.com/stream-utils/stream-to-array but simpler

About

Convert a stream (or string, array) to buffer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published