How to use the pn/fs.createReadStream function in pn

To help you get started, we’ve selected a few pn 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 jsdom / jsdom / test / api / encoding.js View on Github external
return createServer((req, res) => {
        const [, fixture, query] = /^\/([^?]+)(\?.*)?$/.exec(req.url);

        const headers = { "Content-Type": "text/html" };
        if (query === "?charset=csiso88598e") {
          headers["Content-Type"] = "text/html;charset=csiso88598e";
        }

        res.writeHead(200, headers);
        fs.createReadStream(fixturePath(fixture)).pipe(res);
      }).then(s => {
        server = s;