How to use the nodal.Mime function in nodal

To help you get started, we’ve selected a few nodal 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 keithwhor / nodal / src / app / controllers / static_controller.js View on Github external
fs.readFile(`./static/${filepath}`, (err, buffer) => {

        if (err) {
          return Error404Controller.prototype.get.call(this);
        }

        this.setHeader('Content-Type', Nodal.Mime.lookup(ext) || 'application/octet-stream');

        if (this.getHeader('Content-Type').split(';')[0].split('/')[0] === 'video') {

          let range = this.params.headers.range;
          let len = buffer.byteLength;

          if (range) {

            range = range
              .replace('bytes=', '')
              .split('-')
              .map(v => parseInt(v))
              .filter(v => !isNaN(v))

            if (!range.length) {
              range = [0];

nodal

An API Server and Framework for node.js

MIT
Latest version published 1 year ago

Package Health Score

48 / 100
Full package analysis