Nervous Parrot Muttering

    @seregpie/koa-body

    1.0.1 • Public • Published

    KoaBody

    A simple body fetcher.

    dependencies

    setup

    npm i @seregpie/koa-body

    usage

    let Koa = require('koa');
    let KoaBody = require('@seregpie/koa-body');
    
    let app = new Koa();
    
    app.use(async ctx => {
      ctx.body = await KoaBody.json(ctx);
    });

    Fetch the body as application/json.

    let body = await KoaBody.json(ctx);

    Set explicit limit.

    let body = await KoaBody.json(ctx, {limit: '16mb'});

    Fetch the body as text/plain.

    let body = await KoaBody.text(ctx);

    Fetch the body as a Buffer.

    let body = await KoaBody(ctx);

    Install

    npm i @seregpie/koa-body

    DownloadsWeekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.8 kB

    Total Files

    4

    Last publish

    Collaborators

    • seregpie