How to use inflation - 3 common examples

To help you get started, we’ve selected a few inflation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github transitive-bullshit / functional-typescript / packages / fts-http / src / handler.ts View on Github external
const opts: any = {}
      const len = context.req.headers['content-length']
      const encoding = context.req.headers['content-encoding'] || 'identity'
      if (len && encoding === 'identity') {
        opts.length = +len
      }
      if (debug) {
        console.log(
          'fts-http',
          'raw-body',
          'opts',
          JSON.stringify(opts, null, 2)
        )
      }
      const body = await ((raw(
        inflate(context.req),
        opts
      ) as unknown) as Promise)

      if (debug) {
        console.log('fts-http', 'raw-body', body.byteLength, body)
      }
      return body
    }
  } else {
    let params: any = {}

    if (context.req.method === 'GET') {
      params = context.query
    } else if (context.req.method === 'POST') {
      if (context.is('multipart/form-data')) {
        const form = new multiparty.Form()
github youzan / zan-proxy / src / core / App / middleware / monitor.ts View on Github external
return new Promise((resolve, reject) => {
    raw(inflate(req), 'utf-8', (err, body) => {
      if (err) {
        return reject(err);
      } else {
        return resolve(body);
      }
    });
  });
};
github youzan / zan-proxy / src / core / App / middleware / monitor.ts View on Github external
return new Promise((resolve, reject) => {
      raw(inflate(body), 'utf-8', (err, text) => {
        if (err) {
          return reject(err);
        } else {
          return resolve(text);
        }
      });
    });
  }

inflation

Easily unzip an HTTP stream

MIT
Latest version published 1 year ago

Package Health Score

66 / 100
Full package analysis

Popular inflation functions