How to use the lazystream.Writable function in lazystream

To help you get started, we’ve selected a few lazystream 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 djfun / mc-map-item-tool / src / server / server.js View on Github external
zlib.gzip(nbtData, function(err, data) {
        if (err) {
          let error = new Error('Error while creating map file');
          error.http_code = 500;
          error.zlib_error = err;
          throw error;
        }
        let writeStream = new lazystream.Writable(function () {
          return fs.createWriteStream(`${TMP_DIR}${filename}.dat`)
            .on('close', function () {
              winston.log('info', `Map file written to disk: ${filename}.dat`);
              res.setHeader('Content-Type', 'text/html');
              res.writeHead(200);
              res.end(filename);
            });
        });
        writeStream.write(data);
        writeStream.end();
      });
    } catch (e) {

lazystream

Open Node Streams on demand.

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular lazystream functions