Skip to content

aheinz-fe/subtext

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#subtext

HTTP payload parser.

Build Status

Lead Maintainer: John Brett

subtext is sponsored by Sponsorama.

subtext parses the request body and exposes it in a callback.

## Example

const Http = require('http');
const Subtext = require('subtext');

Http.createServer((request, response) => {

    Subtext.parse(request, null, { parse: true, output: 'data' }, (err, parsed) => {

        response.writeHead(200, { 'Content-Type': 'text/plain' });
        response.end('Payload contains: ' + parsed.payload.toString());
    });

}).listen(1337, '127.0.0.1');

console.log('Server running at http://127.0.0.1:1337/');

API

See the API Reference

Warning for subtext on Node below v4.3.2

A Node bug in versions below Node v4.3.2 meant that the Buffer.byteLength function did not work correctly, and as such, using maxBytes options with multipart payloads will mistake the file buffer size to be incorrectly as bigger than it is. Your options here are either to upgrade to Node version greater than v4.3.2 or increase maxBytes to allow some error in calculation. Background info in this issue here.

About

HTTP payload parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%