Notable Pseudocode Mashups
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    stream-contentpublic

    stream-content

    Convert between stream and buffer(or string).

    npm npm Travis npm

    Usage

    var sc = require('stream-content');

    readAll(readableStream, [encoding], callback)

    Read content from a readable stream.

    sc.readAll(readableStream, encoding, function(err, data) {
        console.log(data);
    });

    writeAll(writableStream, content, [encoding], callback)

    Write content into a writable stream.

    sc.writeAll(writableStream, 'hello world', function(err) {
        console.log('done');
    });

    createReadableStream(content, [encoding])

    Create a readable stream from content.

    sc.createReadableStream('hello world').pipe(process.stdout);

    createReadableStreamFromCallback(fn)

    Create a readable stream from callback of a function.

    sc.createReadableStreamFromCallback(function(cb) {
        setTimeout(function() {
            cb('hello world');
        }, 1000);
    });

    createWritableStreamFromCallback(fn)

    Create a writable stream from callback of a function.

    sc.createWritableStreamFromCallback(function(content, cb) {
        fs.writeFile('file.txt', content, cb);
    });

    install

    npm i stream-content

    Downloadslast 7 days

    0

    version

    0.1.2

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar